Example usage for android.os PersistableBundle getBoolean

List of usage examples for android.os PersistableBundle getBoolean

Introduction

In this page you can find the example usage for android.os PersistableBundle getBoolean.

Prototype

public boolean getBoolean(String key) 

Source Link

Document

Returns the value associated with the given key, or false if no mapping of the desired type exists for the given key.

Usage

From source file:com.android.tv.settings.about.AboutFragment.java

@Override
public boolean onPreferenceTreeClick(Preference preference) {
    switch (preference.getKey()) {
    case KEY_FIRMWARE_VERSION:
        System.arraycopy(mHits, 1, mHits, 0, mHits.length - 1);
        mHits[mHits.length - 1] = SystemClock.uptimeMillis();
        if (mHits[0] >= (SystemClock.uptimeMillis() - 500)) {
            if (mUm.hasUserRestriction(UserManager.DISALLOW_FUN)) {
                Log.d(TAG, "Sorry, no fun for you!");
                return false;
            }/*from w  w w.  j a  va  2s.  co m*/

            Intent intent = new Intent(Intent.ACTION_MAIN);
            intent.setClassName("android", com.android.internal.app.PlatLogoActivity.class.getName());
            try {
                startActivity(intent);
            } catch (Exception e) {
                Log.e(TAG, "Unable to start activity " + intent.toString());
            }
        }
        break;
    case KEY_BUILD_NUMBER:
        // Don't enable developer options for secondary users.
        if (!mUm.isAdminUser())
            return true;

        if (mUm.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES))
            return true;

        if (mDevHitCountdown > 0) {
            mDevHitCountdown--;
            if (mDevHitCountdown == 0) {
                Settings.Global.putInt(getActivity().getContentResolver(),
                        Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
                if (mDevHitToast != null) {
                    mDevHitToast.cancel();
                }
                mDevHitToast = Toast.makeText(getActivity(), R.string.show_dev_on, Toast.LENGTH_LONG);
                mDevHitToast.show();
                // This is good time to index the Developer Options
                //                    Index.getInstance(
                //                            getActivity().getApplicationContext()).updateFromClassNameResource(
                //                            DevelopmentSettings.class.getName(), true, true);

            } else if (mDevHitCountdown > 0 && mDevHitCountdown < (TAPS_TO_BE_A_DEVELOPER - 2)) {
                if (mDevHitToast != null) {
                    mDevHitToast.cancel();
                }
                mDevHitToast = Toast.makeText(getActivity(), getResources().getQuantityString(
                        R.plurals.show_dev_countdown, mDevHitCountdown, mDevHitCountdown), Toast.LENGTH_SHORT);
                mDevHitToast.show();
            }
        } else if (mDevHitCountdown < 0) {
            if (mDevHitToast != null) {
                mDevHitToast.cancel();
            }
            mDevHitToast = Toast.makeText(getActivity(), R.string.show_dev_already, Toast.LENGTH_LONG);
            mDevHitToast.show();
        }
        break;
    case KEY_DEVICE_FEEDBACK:
        sendFeedback();
        break;
    case KEY_SYSTEM_UPDATE_SETTINGS:
        CarrierConfigManager configManager = (CarrierConfigManager) getActivity()
                .getSystemService(Context.CARRIER_CONFIG_SERVICE);
        PersistableBundle b = configManager.getConfig();
        if (b != null && b.getBoolean(CarrierConfigManager.KEY_CI_ACTION_ON_SYS_UPDATE_BOOL)) {
            ciActionOnSysUpdate(b);
        }
        break;
    }
    return super.onPreferenceTreeClick(preference);
}