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.feribg.audiogetter.helpers.Utils.java

/**
 * Returns the correct arm version for use with ffmpeg
 *
 * @return//from  w w w  .ja va2  s .c o  m
 */
public static int armCpuVersion() {
    String cpuAbi = Build.CPU_ABI;
    Log.d(App.TAG, "CPU_ABI: " + cpuAbi);
    if (cpuAbi.equals("armeabi-v7a")) {
        return 7;
    } else if (cpuAbi.equals("armeabi")) {
        return 5;
    } else {
        return 0;
    }
}

From source file:com.apptentive.android.sdk.storage.DeviceManager.java

private static Device generateNewDevice(Context context) {
    Device device = new Device();

    // First, get all the information we can load from static resources.
    device.setOsName("Android");
    device.setOsVersion(Build.VERSION.RELEASE);
    device.setOsBuild(Build.VERSION.INCREMENTAL);
    device.setOsApiLevel(String.valueOf(Build.VERSION.SDK_INT));
    device.setManufacturer(Build.MANUFACTURER);
    device.setModel(Build.MODEL);//from   w  ww  . ja va 2 s. c o  m
    device.setBoard(Build.BOARD);
    device.setProduct(Build.PRODUCT);
    device.setBrand(Build.BRAND);
    device.setCpu(Build.CPU_ABI);
    device.setDevice(Build.DEVICE);
    device.setUuid(GlobalInfo.androidId);
    device.setBuildType(Build.TYPE);
    device.setBuildId(Build.ID);

    // Second, set the stuff that requires querying system services.
    TelephonyManager tm = ((TelephonyManager) (context.getSystemService(Context.TELEPHONY_SERVICE)));
    device.setCarrier(tm.getSimOperatorName());
    device.setCurrentCarrier(tm.getNetworkOperatorName());
    device.setNetworkType(Constants.networkTypeAsString(tm.getNetworkType()));

    // Finally, use reflection to try loading from APIs that are not available on all Android versions.
    device.setBootloaderVersion(Reflection.getBootloaderVersion());
    device.setRadioVersion(Reflection.getRadioVersion());

    device.setLocaleCountryCode(Locale.getDefault().getCountry());
    device.setLocaleLanguageCode(Locale.getDefault().getLanguage());
    device.setLocaleRaw(Locale.getDefault().toString());
    device.setUtcOffset(String.valueOf((TimeZone.getDefault().getRawOffset() / 1000)));
    return device;
}

From source file:de.schildbach.wallet.util.CrashReporter.java

public static void appendDeviceInfo(final Appendable report, final Context context) throws IOException {
    final Resources res = context.getResources();
    final android.content.res.Configuration config = res.getConfiguration();
    final ActivityManager activityManager = (ActivityManager) context
            .getSystemService(Context.ACTIVITY_SERVICE);
    final DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context
            .getSystemService(Context.DEVICE_POLICY_SERVICE);

    report.append("Device Model: " + Build.MODEL + "\n");
    report.append("Android Version: " + Build.VERSION.RELEASE + "\n");
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
        report.append("Android security patch level: ").append(Build.VERSION.SECURITY_PATCH).append("\n");
    report.append("ABIs: ").append(Joiner.on(", ").skipNulls().join(Strings.emptyToNull(Build.CPU_ABI),
            Strings.emptyToNull(Build.CPU_ABI2))).append("\n");
    report.append("Board: " + Build.BOARD + "\n");
    report.append("Brand: " + Build.BRAND + "\n");
    report.append("Device: " + Build.DEVICE + "\n");
    report.append("Display: " + Build.DISPLAY + "\n");
    report.append("Finger Print: " + Build.FINGERPRINT + "\n");
    report.append("Host: " + Build.HOST + "\n");
    report.append("ID: " + Build.ID + "\n");
    report.append("Product: " + Build.PRODUCT + "\n");
    report.append("Tags: " + Build.TAGS + "\n");
    report.append("Time: " + Build.TIME + "\n");
    report.append("Type: " + Build.TYPE + "\n");
    report.append("User: " + Build.USER + "\n");
    report.append("Configuration: " + config + "\n");
    report.append("Screen Layout: size "
            + (config.screenLayout & android.content.res.Configuration.SCREENLAYOUT_SIZE_MASK) + " long "
            + (config.screenLayout & android.content.res.Configuration.SCREENLAYOUT_LONG_MASK) + "\n");
    report.append("Display Metrics: " + res.getDisplayMetrics() + "\n");
    report.append("Memory Class: " + activityManager.getMemoryClass() + "/"
            + activityManager.getLargeMemoryClass()
            + (ActivityManagerCompat.isLowRamDevice(activityManager) ? " (low RAM device)" : "") + "\n");
    report.append("Storage Encryption Status: " + devicePolicyManager.getStorageEncryptionStatus() + "\n");
    report.append("Bluetooth MAC: " + bluetoothMac() + "\n");
    report.append("Runtime: ").append(System.getProperty("java.vm.name")).append(" ")
            .append(System.getProperty("java.vm.version")).append("\n");
}

From source file:name.setup.dance.DanceStepApp.java

/** Called when the activity is first created. */
@Override/*from  w w w .ja va  2s. c o  m*/
public void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "[ACTIVITY] onCreate");
    super.onCreate(savedInstanceState);

    //mStepValue = 0;
    mPaceValue = 0;

    setContentView(R.layout.main);

    mUtils = Utils.getInstance();

    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

    mUtils.DeviceName = m_szDevIDShort;

    Log.v(TAG, "ID: " + m_szDevIDShort);
    Log.v(TAG, "UTILS: " + mUtils.DeviceName);

    // user name
    mTextField = (EditText) findViewById(R.id.name_area);
    mTextField.setCursorVisible(false);

    if (!(mUtils.UserName == "My Name")) {

        mTextField.setText(mUtils.UserName);
    }
    mTextField.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click

            InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            // only will trigger it if no physical keyboard is open
            mgr.showSoftInput(mTextField, InputMethodManager.SHOW_IMPLICIT);

            mTextField.requestFocus();
            mTextField.setCursorVisible(true);
            mOkayButton.setVisibility(View.VISIBLE);

        }

    });

    // init okay Button
    mOkayButton = (Button) findViewById(R.id.okay_button);
    mOkayButton.setVisibility(View.INVISIBLE);
    mOkayButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            mgr.hideSoftInputFromWindow(getWindow().getCurrentFocus().getWindowToken(), 0);

            mTextField.setCursorVisible(false);
            mTextField.clearFocus();
            mUtils.UserName = mTextField.getText().toString();

            // post name via HHTP
            new Thread(new Runnable() {
                public void run() {
                    if (mIsMetric) {
                        postHTTP(mUtils.DeviceName, mUtils.UserName, mStepValue, mDistanceValue);
                    } else {
                        postHTTP(mUtils.DeviceName, mUtils.UserName, mStepValue, mDistanceValue * 1.609344f);
                    }
                }
            }).start();
            mOkayButton.setVisibility(View.INVISIBLE);

            // Post TOAST MESSAGE
            Toast.makeText(getApplicationContext(), getText(R.string.name_saved), Toast.LENGTH_SHORT).show();

        }

    });

    // init Score Button
    mScoreButton = (Button) findViewById(R.id.scoreButton);
    mScoreButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            String url = "http://www.setup.nl/tools/dancestep_app/index.php?id=" + mUtils.DeviceName + "&time="
                    + System.currentTimeMillis();
            Intent i = new Intent(Intent.ACTION_VIEW);
            i.setData(Uri.parse(url));
            startActivity(i);
        }
    });

}

From source file:io.kristal.appinfos.AppInfosPlugin.java

private synchronized static String getUniqueId(Context context) {
    String uniqueID = null;//w  w w . j  av  a2s. c o  m
    SharedPreferences sharedPrefs = context.getSharedPreferences(PREF_UNIQUE_ID, Context.MODE_PRIVATE);
    uniqueID = sharedPrefs.getString(PREF_UNIQUE_ID, null);
    if (uniqueID == null) {
        uniqueID = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
        if (uniqueID == null || uniqueID.length() == 0 || "9774d56d682e549c".equals(uniqueID)) {
            // old version of reto meier
            //uniqueID = UUID.randomUUID().toString();
            uniqueID = "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
        }
        SharedPreferences.Editor editor = sharedPrefs.edit();
        editor.putString(PREF_UNIQUE_ID, uniqueID);
        editor.commit();
    }
    return uniqueID;
}

From source file:org.dolphinemu.dolphinemu.gamelist.GameListActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.gamelist_activity);

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerList = (ListView) findViewById(R.id.left_drawer);

    // Construct list of items to add to the side menu.
    List<SideMenuItem> dir = new ArrayList<SideMenuItem>();
    dir.add(new SideMenuItem(getString(R.string.game_list), 0));
    dir.add(new SideMenuItem(getString(R.string.browse_folder), 1));
    dir.add(new SideMenuItem(getString(R.string.settings), 2));
    dir.add(new SideMenuItem(getString(R.string.about), 3));

    mDrawerAdapter = new SideMenuAdapter(this, R.layout.sidemenu, dir);
    mDrawerList.setAdapter(mDrawerAdapter);
    mDrawerList.setOnItemClickListener(mMenuItemClickListener);

    // Enable ActionBar app icon to behave as action to toggle nav drawer
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);

    // ActionBarDrawerToggle ties together the the proper interactions
    // between the sliding drawer and the action bar app icon
    mDrawerToggle = new ActionBarDrawerToggle(this, /* Host Activity */
            mDrawerLayout, /* DrawerLayout object */
            R.drawable.ic_drawer, /* Navigation drawer image to replace 'Up' caret */
            R.string.drawer_open, /* "open drawer" description for accessibility */
            R.string.drawer_close /* "close drawer" description for accessibility */
    ) {/* ww  w  .  j a  v  a 2 s. c om*/
        public void onDrawerClosed(View view) {
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }

        public void onDrawerOpened(View drawerView) {
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }
    };
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    // Stuff in this block only happens when this activity is newly created (i.e. not a rotation)
    if (savedInstanceState == null) {
        // Copy assets into appropriate locations.
        Intent copyAssets = new Intent(this, AssetCopyService.class);
        startService(copyAssets);

        // Display the game list fragment.
        final GameListFragment gameList = new GameListFragment();
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.replace(R.id.content_frame, gameList);
        ft.commit();
    }

    // Create an alert telling them that their phone sucks
    if (Build.CPU_ABI.contains("arm") && !NativeLibrary.SupportsNEON()) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(R.string.device_compat_warning);
        builder.setMessage(R.string.device_compat_warning_msg);
        builder.setPositiveButton(R.string.yes, null);
        builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
        builder.show();
    }
}

From source file:ly.count.android.sdk.CrashDetails.java

/**
 * Returns the current device cpu./*from w  ww  .j av a  2 s  .  co m*/
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
static String getCpu() {
    if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
        return android.os.Build.CPU_ABI;
    else
        return Build.SUPPORTED_ABIS[0];
}

From source file:com.theaetetuslabs.android_apkmaker.AndroidApkMaker.java

private static File unpackAapt(Context context, File aapt) throws IOException {
    if (!aapt.exists()) {
        String aaptToUse = null;//from   w w  w  . ja  v  a  2s.  c  om
        boolean usePie = VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN;
        String abi;
        if (VERSION.SDK_INT > VERSION_CODES.LOLLIPOP) {
            String[] abis = Build.SUPPORTED_32_BIT_ABIS;
            for (String mAbi : abis) {
                aaptToUse = getAaptFlavor(mAbi, usePie);
                if (aaptToUse != null) {
                    break;
                }
            }
        } else {
            aaptToUse = getAaptFlavor(Build.CPU_ABI, usePie);
        }
        if (aaptToUse == null) {
            aaptToUse = "aapt-arm";
        }
        if (usePie) {
            aaptToUse += "-pie";
        }
        unpackAsset(context, aaptToUse, aapt);
    }
    if (!aapt.canExecute()) {
        aapt.setExecutable(true, true);
    }
    if (!aapt.canExecute()) {
        Runtime.getRuntime().exec("chmod 777 " + aapt.getAbsolutePath());
    }
    return aapt;
}

From source file:com.bearstouch.android.core.InstallTracker.java

public void trackInstall(Activity activity, String app_name, String app_version_name) {

    mGTracker.trackEvent(INSTALL_TRACK_EVENT_TAG, APP_NAME_VAR, app_name, 1);
    mGTracker.trackEvent(INSTALL_TRACK_EVENT_TAG, APP_VERSION_VAR, app_version_name, 1);
    mGTracker.trackEvent(INSTALL_TRACK_EVENT_TAG, SDK_VERSION_VAR, Integer.toString(Build.VERSION.SDK_INT), 1);
    mGTracker.trackEvent(INSTALL_TRACK_EVENT_TAG, PHONE_VAR,
            Build.MANUFACTURER + " " + Build.PRODUCT + " " + Build.MODEL, 1);
    mGTracker.trackEvent(INSTALL_TRACK_EVENT_TAG, CPU_VAR, Build.CPU_ABI, 1);
    String installationSource = mContext.getPackageManager().getInstallerPackageName(mContext.getPackageName());
    mGTracker.trackEvent(INSTALL_TRACK_EVENT_TAG, INSTALLER_VAR, installationSource, 1);

    // Ecra// w  ww.  jav a2  s  .c o  m
    DisplayMetrics displayMetrics = AndroidUtil.getDisplayMetrics(activity);
    if (displayMetrics != null) {
        String Resolution = displayMetrics.widthPixels + "x" + displayMetrics.heightPixels;
        String dpis = displayMetrics.xdpi + "x" + displayMetrics.ydpi;
        mGTracker.trackEvent(INSTALL_TRACK_EVENT_TAG, "RESOLUTION", Resolution, 1);
        mGTracker.trackEvent(INSTALL_TRACK_EVENT_TAG, "DPI", dpis, 1);
    }
}

From source file:com.azure.webapi.MobileServiceConnection.java

/**
 * Generates the User-Agent//from w w w .  ja  va2  s  .  com
 */
static String getUserAgent() {
    String userAgent = String.format("ZUMO/%s (lang=%s; os=%s; os_version=%s; arch=%s)", SDK_VERSION, "Java",
            "Android", Build.VERSION.RELEASE, Build.CPU_ABI);

    return userAgent;
}