Exemplo n.º 1
0
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
    mBackupManager =
        IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));

    addPreferencesFromResource(R.xml.development_prefs);

    mEnableAdb = (CheckBoxPreference) findPreference(ENABLE_ADB);
    mKeepScreenOn = (CheckBoxPreference) findPreference(KEEP_SCREEN_ON);
    mAllowMockLocation = (CheckBoxPreference) findPreference(ALLOW_MOCK_LOCATION);
    mPassword = (PreferenceScreen) findPreference(LOCAL_BACKUP_PASSWORD);

    mStrictMode = (CheckBoxPreference) findPreference(STRICT_MODE_KEY);
    mPointerLocation = (CheckBoxPreference) findPreference(POINTER_LOCATION_KEY);
    mShowTouches = (CheckBoxPreference) findPreference(SHOW_TOUCHES_KEY);
    mShowScreenUpdates = (CheckBoxPreference) findPreference(SHOW_SCREEN_UPDATES_KEY);
    mShowCpuUsage = (CheckBoxPreference) findPreference(SHOW_CPU_USAGE_KEY);
    mForceHardwareUi = (CheckBoxPreference) findPreference(FORCE_HARDWARE_UI_KEY);
    mWindowAnimationScale = (ListPreference) findPreference(WINDOW_ANIMATION_SCALE_KEY);
    mWindowAnimationScale.setOnPreferenceChangeListener(this);
    mTransitionAnimationScale = (ListPreference) findPreference(TRANSITION_ANIMATION_SCALE_KEY);
    mTransitionAnimationScale.setOnPreferenceChangeListener(this);

    mImmediatelyDestroyActivities =
        (CheckBoxPreference) findPreference(IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
    mAppProcessLimit = (ListPreference) findPreference(APP_PROCESS_LIMIT_KEY);
    mAppProcessLimit.setOnPreferenceChangeListener(this);

    mShowAllANRs = (CheckBoxPreference) findPreference(SHOW_ALL_ANRS_KEY);

    final Preference verifierDeviceIdentifier = findPreference(VERIFIER_DEVICE_IDENTIFIER);
    final PackageManager pm = getActivity().getPackageManager();
    final VerifierDeviceIdentity verifierIndentity = pm.getVerifierDeviceIdentity();
    if (verifierIndentity != null) {
      verifierDeviceIdentifier.setSummary(verifierIndentity.toString());
    }

    removeHdcpOptionsForProduction();
  }
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
    mBackupManager =
        IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));
    mDpm = (DevicePolicyManager) getActivity().getSystemService(Context.DEVICE_POLICY_SERVICE);

    addPreferencesFromResource(R.xml.development_prefs);

    mEnableAdb = findAndInitCheckboxPref(ENABLE_ADB);
    mBugreport = findPreference(BUGREPORT);
    mBugreportInPower = findAndInitCheckboxPref(BUGREPORT_IN_POWER_KEY);
    mKeepScreenOn = findAndInitCheckboxPref(KEEP_SCREEN_ON);
    mEnforceReadExternal = findAndInitCheckboxPref(ENFORCE_READ_EXTERNAL);
    mAllowMockLocation = findAndInitCheckboxPref(ALLOW_MOCK_LOCATION);
    mPassword = (PreferenceScreen) findPreference(LOCAL_BACKUP_PASSWORD);
    mAllPrefs.add(mPassword);

    mDebugAppPref = findPreference(DEBUG_APP_KEY);
    mAllPrefs.add(mDebugAppPref);
    mWaitForDebugger = findAndInitCheckboxPref(WAIT_FOR_DEBUGGER_KEY);
    mVerifyAppsOverUsb = findAndInitCheckboxPref(VERIFY_APPS_OVER_USB_KEY);
    if (!showVerifierSetting()) {
      PreferenceGroup debugDebuggingCategory =
          (PreferenceGroup) findPreference(DEBUG_DEBUGGING_CATEGORY_KEY);
      if (debugDebuggingCategory != null) {
        debugDebuggingCategory.removePreference(mVerifyAppsOverUsb);
      } else {
        mVerifyAppsOverUsb.setEnabled(false);
      }
    }
    mStrictMode = findAndInitCheckboxPref(STRICT_MODE_KEY);
    mPointerLocation = findAndInitCheckboxPref(POINTER_LOCATION_KEY);
    mShowTouches = findAndInitCheckboxPref(SHOW_TOUCHES_KEY);
    mShowScreenUpdates = findAndInitCheckboxPref(SHOW_SCREEN_UPDATES_KEY);
    mDisableOverlays = findAndInitCheckboxPref(DISABLE_OVERLAYS_KEY);
    mShowCpuUsage = findAndInitCheckboxPref(SHOW_CPU_USAGE_KEY);
    mForceHardwareUi = findAndInitCheckboxPref(FORCE_HARDWARE_UI_KEY);
    mForceMsaa = findAndInitCheckboxPref(FORCE_MSAA_KEY);
    mTrackFrameTime = findAndInitCheckboxPref(TRACK_FRAME_TIME_KEY);
    mShowHwScreenUpdates = findAndInitCheckboxPref(SHOW_HW_SCREEN_UPDATES_KEY);
    mShowHwLayersUpdates = findAndInitCheckboxPref(SHOW_HW_LAYERS_UPDATES_KEY);
    mShowHwOverdraw = findAndInitCheckboxPref(SHOW_HW_OVERDRAW_KEY);
    mDebugLayout = findAndInitCheckboxPref(DEBUG_LAYOUT_KEY);
    mWindowAnimationScale = (ListPreference) findPreference(WINDOW_ANIMATION_SCALE_KEY);
    mAllPrefs.add(mWindowAnimationScale);
    mWindowAnimationScale.setOnPreferenceChangeListener(this);
    mTransitionAnimationScale = (ListPreference) findPreference(TRANSITION_ANIMATION_SCALE_KEY);
    mAllPrefs.add(mTransitionAnimationScale);
    mTransitionAnimationScale.setOnPreferenceChangeListener(this);
    mAnimatorDurationScale = (ListPreference) findPreference(ANIMATOR_DURATION_SCALE_KEY);
    mAllPrefs.add(mAnimatorDurationScale);
    mAnimatorDurationScale.setOnPreferenceChangeListener(this);
    mOverlayDisplayDevices = (ListPreference) findPreference(OVERLAY_DISPLAY_DEVICES_KEY);
    mAllPrefs.add(mOverlayDisplayDevices);
    mOverlayDisplayDevices.setOnPreferenceChangeListener(this);
    mOpenGLTraces = (ListPreference) findPreference(OPENGL_TRACES_KEY);
    mAllPrefs.add(mOpenGLTraces);
    mOpenGLTraces.setOnPreferenceChangeListener(this);
    mEnableTracesPref = (MultiCheckPreference) findPreference(ENABLE_TRACES_KEY);
    String[] traceValues = new String[Trace.TRACE_TAGS.length];
    for (int i = Trace.TRACE_FLAGS_START_BIT; i < traceValues.length; i++) {
      traceValues[i] = Integer.toString(1 << i);
    }
    mEnableTracesPref.setEntries(Trace.TRACE_TAGS);
    mEnableTracesPref.setEntryValues(traceValues);
    mAllPrefs.add(mEnableTracesPref);
    mEnableTracesPref.setOnPreferenceChangeListener(this);

    mImmediatelyDestroyActivities =
        (CheckBoxPreference) findPreference(IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
    mAllPrefs.add(mImmediatelyDestroyActivities);
    mResetCbPrefs.add(mImmediatelyDestroyActivities);
    mAppProcessLimit = (ListPreference) findPreference(APP_PROCESS_LIMIT_KEY);
    mAllPrefs.add(mAppProcessLimit);
    mAppProcessLimit.setOnPreferenceChangeListener(this);

    mShowAllANRs = (CheckBoxPreference) findPreference(SHOW_ALL_ANRS_KEY);
    mAllPrefs.add(mShowAllANRs);
    mResetCbPrefs.add(mShowAllANRs);

    mKillAppLongpressBack = findAndInitCheckboxPref(KILL_APP_LONGPRESS_BACK);

    Preference hdcpChecking = findPreference(HDCP_CHECKING_KEY);
    if (hdcpChecking != null) {
      mAllPrefs.add(hdcpChecking);
    }
    removeHdcpOptionsForProduction();
  }