Example usage for android.os Build CPU_ABI

List of usage examples for android.os Build CPU_ABI

Introduction

In this page you can find the example usage for android.os Build CPU_ABI.

Prototype

String CPU_ABI

To view the source code for android.os Build CPU_ABI.

Click Source Link

Document

The name of the instruction set (CPU type + ABI convention) of native code.

Usage

From source file:com.github.chenxiaolong.dualbootpatcher.socket.MbtoolSocket.java

@SuppressWarnings("deprecation")
private synchronized boolean executeMbtool(Context context) {
    PatcherUtils.extractPatcher(context);
    String abi;/*from  w w  w . j  a  va 2 s.  com*/
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        abi = Build.SUPPORTED_ABIS[0];
    } else {
        abi = Build.CPU_ABI;
    }

    String mbtool = PatcherUtils.getTargetDirectory(context) + "/binaries/android/" + abi + "/mbtool";

    return CommandUtils.runRootCommand("mount -o remount,rw /") == 0
            && CommandUtils.runRootCommand("mv /mbtool /mbtool.bak || :") == 0
            && CommandUtils.runRootCommand("cp " + mbtool + " /mbtool") == 0
            && CommandUtils.runRootCommand("chmod 755 /mbtool") == 0
            && CommandUtils.runRootCommand("mount -o remount,ro / || :") == 0
            && CommandUtils.runRootCommand("/mbtool daemon --replace --daemonize") == 0;
}

From source file:org.kde.necessitas.ministro.MinistroActivity.java

private static URL getVersionUrl(Context c) throws MalformedURLException {
    return new URL(DOMAIN_NAME + MinistroService.getRepository(c) + "/" + android.os.Build.CPU_ABI + "/android-"
            + android.os.Build.VERSION.SDK_INT + "/versions.xml");
}

From source file:org.torproject.android.OrbotMainActivity.java

private void doLayout() {
    setContentView(R.layout.layout_main);

    setTitle(R.string.app_name);//from   w  w w. ja va 2 s  . c  om

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawer, toolbar, android.R.string.ok,
            android.R.string.cancel);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);

    mDrawer.setDrawerListener(mDrawerToggle);
    mDrawerToggle.syncState();

    mTxtOrbotLog = (TextView) findViewById(R.id.orbotLog);

    lblStatus = (TextView) findViewById(R.id.lblStatus);
    lblStatus.setOnLongClickListener(this);
    imgStatus = (ImageProgressView) findViewById(R.id.imgStatus);
    imgStatus.setOnLongClickListener(this);
    imgStatus.setOnTouchListener(this);

    downloadText = (TextView) findViewById(R.id.trafficDown);
    uploadText = (TextView) findViewById(R.id.trafficUp);

    downloadText.setText(formatCount(0) + " / " + formatTotal(0));
    uploadText.setText(formatCount(0) + " / " + formatTotal(0));

    // Gesture detection
    mGestureDetector = new GestureDetector(this, new MyGestureDetector());

    mBtnBrowser = (Button) findViewById(R.id.btnBrowser);
    mBtnBrowser.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            doTorCheck();

        }

    });

    mBtnBrowser.setEnabled(false);

    mBtnVPN = (ToggleButton) findViewById(R.id.btnVPN);

    boolean useVPN = Prefs.useVpn();
    mBtnVPN.setChecked(useVPN);

    //auto start VPN if VPN is enabled
    if (useVPN) {
        startActivity(new Intent(OrbotMainActivity.this, VPNEnableActivity.class));
    }

    mBtnVPN.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            if (mBtnVPN.isChecked())
                startActivity(new Intent(OrbotMainActivity.this, VPNEnableActivity.class));
            else
                stopVpnService();

        }

    });

    mBtnBridges = (ToggleButton) findViewById(R.id.btnBridges);
    mBtnBridges.setChecked(Prefs.bridgesEnabled());
    mBtnBridges.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (Build.CPU_ABI.contains("arm")) {
                promptSetupBridges(); //if ARM processor, show all bridge options

            } else {
                Toast.makeText(OrbotMainActivity.this,
                        R.string.note_only_standard_tor_bridges_work_on_intel_x86_atom_devices,
                        Toast.LENGTH_LONG).show();
                showGetBridgePrompt(""); //if other chip ar, only stock bridges are supported
            }
        }

    });

    String currentExit = Prefs.getExitNodes();
    int selIdx = -1;

    ArrayList<String> cList = new ArrayList<String>();
    cList.add(0, getString(R.string.vpn_default_world));

    for (int i = 0; i < TorServiceConstants.COUNTRY_CODES.length; i++) {
        Locale locale = new Locale("", TorServiceConstants.COUNTRY_CODES[i]);
        cList.add(locale.getDisplayCountry());

        if (currentExit.contains(TorServiceConstants.COUNTRY_CODES[i]))
            selIdx = i + 1;
    }

    spnCountries = (Spinner) findViewById(R.id.spinnerCountry);
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, cList);
    spnCountries.setAdapter(adapter);

    if (selIdx != -1)
        spnCountries.setSelection(selIdx);

    spnCountries.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
            // your code here

            String country = null;

            if (position == 0)
                country = "";
            else
                country = '{' + TorServiceConstants.COUNTRY_CODES[position - 1] + '}';

            Intent torService = new Intent(OrbotMainActivity.this, TorService.class);
            torService.setAction(TorServiceConstants.CMD_SET_EXIT);
            torService.putExtra("exit", country);
            startService(torService);

        }

        @Override
        public void onNothingSelected(AdapterView<?> parentView) {
            // your code here
        }

    });
}

From source file:org.kde.necessitas.ministro.MinistroActivity.java

private static URL getLibsXmlUrl(Context c, String version) throws MalformedURLException {
    return new URL(DOMAIN_NAME + MinistroService.getRepository(c) + "/" + android.os.Build.CPU_ABI + "/android-"
            + android.os.Build.VERSION.SDK_INT + "/libs-" + version + ".xml");
}

From source file:it.evilsocket.dsploit.core.System.java

public static boolean isARM() {
    String abi = Build.CPU_ABI;

    Log.d(TAG, "Build.CPU_ABI = " + abi);

    return Build.CPU_ABI.toLowerCase().startsWith("armeabi");
}

From source file:org.protocoderrunner.apprunner.api.PDevice.java

@ProtoMethod(description = "Get some device information", example = "")
@ProtoMethodParam(params = { "" })
public DeviceInfo info() {
    DeviceInfo deviceInfo = new DeviceInfo();

    // density dpi
    DisplayMetrics metrics = new DisplayMetrics();

    //TODO reenable this
    //contextUi.get().getWindowManager().getDefaultDisplay().getMetrics(metrics);
    deviceInfo.screenDpi = metrics.densityDpi;

    // id//  w  w w . j  av a2s  .com
    deviceInfo.androidId = Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID);

    // imei
    deviceInfo.imei = ((TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE))
            .getDeviceId();

    deviceInfo.versionRelease = Build.VERSION.RELEASE;
    deviceInfo.versionRelease = Build.VERSION.INCREMENTAL;
    deviceInfo.sdk = Build.VERSION.SDK;
    deviceInfo.board = Build.BOARD;
    deviceInfo.brand = Build.BRAND;
    deviceInfo.device = Build.DEVICE;
    deviceInfo.fingerPrint = Build.FINGERPRINT;
    deviceInfo.host = Build.HOST;
    deviceInfo.id = Build.ID;
    deviceInfo.cpuAbi = Build.CPU_ABI;
    deviceInfo.cpuAbi2 = Build.CPU_ABI2;

    return deviceInfo;
}

From source file:de.schildbach.wallet.ui.ReportIssueDialogFragment.java

@SuppressWarnings("deprecation")
private static String[] supportedAbisKitKat() {
    return new String[] { Strings.emptyToNull(Build.CPU_ABI), Strings.emptyToNull(Build.CPU_ABI2) };
}

From source file:com.github.chenxiaolong.dualbootpatcher.switcher.service.MbtoolTask.java

private boolean performBackupRestore(BackupRestoreParams params, MbtoolInterface iface)
        throws IOException, MbtoolCommandException, MbtoolException {
    printSeparator();//w ww . j a v a  2 s  .  co m

    switch (params.getAction()) {
    case BACKUP:
        printBoldText(Color.MAGENTA, "Backup:\n");
        break;
    case RESTORE:
        printBoldText(Color.MAGENTA, "Restore:\n");
        break;
    }

    printBoldText(Color.MAGENTA, "- ROM ID: " + params.getRomId() + "\n");
    printBoldText(Color.MAGENTA, "- Targets: " + Arrays.toString(params.getTargets()) + "\n");
    printBoldText(Color.MAGENTA, "- Backup name: " + params.getBackupName() + "\n");
    printBoldText(Color.MAGENTA, "- Backup dir URI: " + params.getBackupDirUri() + "\n");
    printBoldText(Color.MAGENTA, "- Force/overwrite: " + params.getForce() + "\n");

    printSeparator();

    printBoldText(Color.YELLOW, "Extracting patcher data archive\n");
    PatcherUtils.extractPatcher(getContext());

    printSeparator();

    String backupDir = null;
    if (params.getBackupDirUri() != null) {
        backupDir = getPathFromUri(params.getBackupDirUri(), iface);
        if (backupDir == null) {
            return false;
        }
    }

    String abi;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        abi = Build.SUPPORTED_ABIS[0];
    } else {
        abi = Build.CPU_ABI;
    }

    File mbtoolRecovery = new File(PatcherUtils.getTargetDirectory(getContext()) + File.separator + "binaries"
            + File.separator + "android" + File.separator + abi + File.separator + "mbtool_recovery");
    File mbtoolRecoverySig = new File(
            PatcherUtils.getTargetDirectory(getContext()) + File.separator + "binaries" + File.separator
                    + "android" + File.separator + abi + File.separator + "mbtool_recovery.sig");

    String argv0;
    switch (params.getAction()) {
    case BACKUP:
        argv0 = "backup";
        break;
    case RESTORE:
        argv0 = "restore";
        break;
    default:
        throw new IllegalStateException("Invalid action: " + params.getAction());
    }

    ArrayList<String> args = new ArrayList<>();
    args.add("-r");
    args.add(params.getRomId());
    args.add("-t");
    args.add(StringUtils.join(params.getTargets(), ','));
    if (params.getBackupName() != null) {
        args.add("-n");
        args.add(params.getBackupName());
    }
    if (backupDir != null) {
        args.add("-d");
        args.add(translateEmulatedPath(backupDir));
    }
    if (params.getForce()) {
        args.add("-f");
    }

    String[] argsArray = args.toArray(new String[args.size()]);

    printBoldText(Color.YELLOW, "Running " + argv0 + " with arguments: [" + TextUtils.join(", ", args) + "]\n");

    SignedExecCompletion completion = iface.signedExec(mbtoolRecovery.getAbsolutePath(),
            mbtoolRecoverySig.getAbsolutePath(), argv0, argsArray, this);

    switch (completion.result) {
    case SignedExecResult.PROCESS_EXITED:
        printBoldText(completion.exitStatus == 0 ? Color.GREEN : Color.RED,
                "\nCommand returned: " + completion.exitStatus + "\n");
        return completion.exitStatus == 0;
    case SignedExecResult.PROCESS_KILLED_BY_SIGNAL:
        printBoldText(Color.RED, "\nProcess killed by signal: " + completion.termSig + "\n");
        return false;
    case SignedExecResult.INVALID_SIGNATURE:
        printBoldText(Color.RED,
                "\nThe mbtool binary has an invalid signature. This"
                        + " means DualBootPatcher's data files have been maliciously modified"
                        + " by somebody or another app. The backup/restore process has been" + " cancelled.\n");
        return false;
    case SignedExecResult.OTHER_ERROR:
    default:
        printBoldText(Color.RED, "\nError: " + completion.errorMsg + "\n");
        return false;
    }
}

From source file:org.feedhenry.welcome.fragments.NativeAppInfoFragment.java

private void getDeviceInformation() {

    manufactorurer.setText(Build.MANUFACTURER);
    model.setText(Build.MODEL);// w  w w.j  av a  2s  . c o  m
    product.setText(Build.PRODUCT);
    serial.setText(Build.SERIAL);
    cpu.setText(Build.CPU_ABI);
    host.setText(Build.HOST);
}

From source file:com.lewa.crazychapter11.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    //set to full screen
    // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,  WindowManager.LayoutParams.FLAG_FULLSCREEN);

    ///set to no title
    // requestWindowFeature(Window.FEATURE_NO_TITLE);
    // acionBar = getSupportActionBar();
    // acionBar = getActionBar();
    // acionBar.hide();

    // Window win = getWindow();
    //          win.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    //          win.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS  | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);  
    //          win.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);  
    // win.setStatusBarColor(Color.TRANSPARENT);  
    // win.setNavigationBarColor(Color.TRANSPARENT);

    /*//*  w  w w.  j a  v  a 2s . c  o m*/
       win.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
       win.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS  | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);  
       win.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN  | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION  | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);  
       win.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);  
       win.setStatusBarColor(Color.TRANSPARENT);  
       win.setNavigationBarColor(Color.TRANSPARENT);
    //*/

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    /* setTheme(R.style.CrazyTheme); */
    AddGameBtn();
    AddNoification();
    LookupContact();
    AddServiceBtn();
    broadcastMain();
    mediaPlayerMain();
    mediaRecordSoundMain();
    cameraMain();
    recordvideoMain();
    queMySql();
    TestFragment();
    justForTest();
    LoadJson();
    AddTestBtn();
    AddUsageStatsBtn();
    AddPeopleProvideBtn();
    getInput();

    ////just for test shutdown broadcast receiver
    IntentFilter mIntentFilter = new IntentFilter("android.intent.action.ACTION_SHUTDOWN");
    mIntentFilter.addAction("com.lewa.alarm.test");
    mIntentFilter.addAction("android.provider.Telephony.SECRET_CODE");
    mIntentFilter.addAction("android.intent.action.SCREEN_ON");
    mIntentFilter.addAction("android.intent.action.SCREEN_OFF");
    mShoutdown = new shutdownReceiver();
    registerReceiver(mShoutdown, mIntentFilter);
    ////test      

    preferences = getSharedPreferences("crazyit", MODE_WORLD_WRITEABLE | MODE_WORLD_READABLE);
    editor = preferences.edit();

    preferencestime = getSharedPreferences("RMS_Shutdown_time", MODE_WORLD_WRITEABLE | MODE_WORLD_READABLE);
    editortime = preferencestime.edit();

    SharedShutdownTimeRead();

    AddSharedPreBtn();

    etNum = (EditText) findViewById(R.id.etNum);

    // //
    int maxLength = 4;

    InputFilter[] fArray = new InputFilter[1];

    fArray[0] = new InputFilter.LengthFilter(maxLength);

    etNum.setFilters(fArray);
    // //

    calThread = new CalThread();
    calThread.start();

    Log.i("algerheMain", "MainActivity onCreate in!!");
    String page = getString(R.string.str_page, "345", "24");
    Log.i("algerheMain", "page=" + page);

    // /just for test here
    ComponentName comp = getIntent().getComponent();
    show_txt = (EditText) findViewById(R.id.show_txt);
    show_txt.setText(
            "??" + comp.getPackageName() + " \n ??" + comp.getClassName());

    ////MD5 check item
    ///1.IMEI
    TelephonyManager TelephonyMgr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
    String szImei = TelephonyMgr.getDeviceId();
    String m_szSIMSerialNm = TelephonyMgr.getSimSerialNumber();
    CellLocation m_location = TelephonyMgr.getCellLocation();
    String m_Line1Number = TelephonyMgr.getLine1Number();
    String m_OperatorName = TelephonyMgr.getSimOperatorName();
    Log.i("algerheTelephonyMgr", "szImei=" + szImei);
    Log.i("algerheTelephonyMgr", "m_szSIMSerialNm=" + m_szSIMSerialNm);
    Log.i("algerheTelephonyMgr", "m_location=" + m_location);
    Log.i("algerheTelephonyMgr", "m_Line1Number=" + m_Line1Number);
    Log.i("algerheTelephonyMgr", "m_OperatorName=" + m_OperatorName);

    Log.i("algerheMain01", "szImei=" + szImei);
    Log.i("algerheMain01", "m_szSIMSerialNm=" + m_szSIMSerialNm);

    ///2.Pseudo-Unique ID
    String m_szDevIDShort = "35" + //we make this look like a valid IMEI 
            Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.length() % 10
            + Build.DEVICE.length() % 10 + Build.DISPLAY.length() % 10 + Build.HOST.length() % 10
            + Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 + Build.MODEL.length() % 10
            + Build.PRODUCT.length() % 10 + Build.TAGS.length() % 10 + Build.TYPE.length() % 10
            + Build.USER.length() % 10; //13 digits

    Log.i("algerheMain01", "m_szDevIDShort=" + m_szDevIDShort);

    ///3. Android ID
    String m_szAndroidID = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
    Log.i("algerheMain01", "m_szAndroidID=" + m_szAndroidID);

    ///4.WLAN MAC Address string
    WifiManager wm = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    String m_szWLANMAC = "unknow_wifi_mac";
    if (wm != null && wm.getConnectionInfo() != null) {
        m_szWLANMAC = wm.getConnectionInfo().getMacAddress();
    }

    Log.i("algerheMain01", "m_szWLANMAC=" + m_szWLANMAC);

    ///5.BT MAC Address string
    BluetoothAdapter m_BluetoothAdapter = null; // Local Bluetooth adapter      
    m_BluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    String m_szBTMAC = m_BluetoothAdapter.getAddress();

    Log.i("algerheMain01", "m_szBTMAC=" + m_szBTMAC);

    ///6.sim serial number .getSimSerialNumber()

    // /

    ///reflect test   
    checkMethod();

    // */
    final Intent alarmIntent = new Intent();
    Log.i("algerheMain00", "isLewaRom=" + isLewaRom(this, alarmIntent));

    handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            if (msg.what == 0x4567) {
                String languageStr = null;
                String countryStr = null;

                Locale[] locList = Locale.getAvailableLocales();

                for (int i = 0; i < locList.length; i++) {
                    languageStr += locList[i].getLanguage();
                    countryStr += locList[i].getCountry();
                }
                // show_txt = (EditText) findViewById(R.id.show_txt);
                show_txt.setText("" + languageStr + " \n " + countryStr);
            } else if (msg.what == 0x2789) {
                Log.i("algerheAlarm", "send alarm message in time=" + System.currentTimeMillis() + "\n action="
                        + alarmIntent.getAction());

                // sendBroadcast(alarmIntent);
            }
        }
    };

    // String strApkPath = intent.getStringExtra("apkPath");
    //         String strCmd = "pm install -r " + strApkPath;
    //         try {
    //             Process install = Runtime.getRuntime().exec(strCmd);
    //             Log.d(TAG, "install = " + install + ", strCmd =" + strCmd);
    //         }catch (Exception ex){
    //             Log.d(TAG, ex.getMessage());
    //         }   
    // */
}