private void updateFlingerOptions() {
   // magic communication with surface flinger.
   try {
     IBinder flinger = ServiceManager.getService("SurfaceFlinger");
     if (flinger != null) {
       Parcel data = Parcel.obtain();
       Parcel reply = Parcel.obtain();
       data.writeInterfaceToken("android.ui.ISurfaceComposer");
       flinger.transact(1010, data, reply, 0);
       @SuppressWarnings("unused")
       int showCpu = reply.readInt();
       @SuppressWarnings("unused")
       int enableGL = reply.readInt();
       int showUpdates = reply.readInt();
       updateCheckBox(mShowScreenUpdates, showUpdates != 0);
       @SuppressWarnings("unused")
       int showBackground = reply.readInt();
       int disableOverlays = reply.readInt();
       updateCheckBox(mDisableOverlays, disableOverlays != 0);
       reply.recycle();
       data.recycle();
     }
   } catch (RemoteException ex) {
   }
 }
 private void updateCpuUsageOptions() {
   updateCheckBox(
       mShowCpuUsage,
       Settings.Global.getInt(
               getActivity().getContentResolver(), Settings.Global.SHOW_PROCESSES, 0)
           != 0);
 }
 private void updatePointerLocationOptions() {
   updateCheckBox(
       mPointerLocation,
       Settings.System.getInt(
               getActivity().getContentResolver(), Settings.System.POINTER_LOCATION, 0)
           != 0);
 }
 private void updateImmediatelyDestroyActivitiesOptions() {
   updateCheckBox(
       mImmediatelyDestroyActivities,
       Settings.Global.getInt(
               getActivity().getContentResolver(), Settings.Global.ALWAYS_FINISH_ACTIVITIES, 0)
           != 0);
 }
 private void updateDebuggerOptions() {
   mDebugApp =
       Settings.Global.getString(getActivity().getContentResolver(), Settings.Global.DEBUG_APP);
   updateCheckBox(
       mWaitForDebugger,
       Settings.Global.getInt(
               getActivity().getContentResolver(), Settings.Global.WAIT_FOR_DEBUGGER, 0)
           != 0);
   if (mDebugApp != null && mDebugApp.length() > 0) {
     String label;
     try {
       ApplicationInfo ai =
           getActivity()
               .getPackageManager()
               .getApplicationInfo(mDebugApp, PackageManager.GET_DISABLED_COMPONENTS);
       CharSequence lab = getActivity().getPackageManager().getApplicationLabel(ai);
       label = lab != null ? lab.toString() : mDebugApp;
     } catch (PackageManager.NameNotFoundException e) {
       label = mDebugApp;
     }
     mDebugAppPref.setSummary(getResources().getString(R.string.debug_app_set, label));
     mWaitForDebugger.setEnabled(true);
     mHaveDebugSettings = true;
   } else {
     mDebugAppPref.setSummary(getResources().getString(R.string.debug_app_not_set));
     mWaitForDebugger.setEnabled(false);
   }
 }
 private void updateShowAllANRsOptions() {
   updateCheckBox(
       mShowAllANRs,
       Settings.Secure.getInt(
               getActivity().getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0)
           != 0);
 }
 private void updateVerifyAppsOverUsbOptions() {
   updateCheckBox(
       mVerifyAppsOverUsb,
       Settings.Global.getInt(
               getActivity().getContentResolver(), Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB, 1)
           != 0);
   mVerifyAppsOverUsb.setEnabled(enableVerifierSetting());
 }
 private void updateAllOptions() {
   final Context context = getActivity();
   final ContentResolver cr = context.getContentResolver();
   mHaveDebugSettings = false;
   updateCheckBox(mEnableAdb, Settings.Global.getInt(cr, Settings.Global.ADB_ENABLED, 0) != 0);
   updateCheckBox(
       mBugreportInPower,
       Settings.Secure.getInt(cr, Settings.Secure.BUGREPORT_IN_POWER_MENU, 0) != 0);
   updateCheckBox(
       mKeepScreenOn,
       Settings.Global.getInt(cr, Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 0) != 0);
   updateCheckBox(mEnforceReadExternal, isPermissionEnforced(READ_EXTERNAL_STORAGE));
   updateCheckBox(
       mAllowMockLocation,
       Settings.Secure.getInt(cr, Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0);
   updateHdcpValues();
   updatePasswordSummary();
   updateDebuggerOptions();
   updateStrictModeVisualOptions();
   updatePointerLocationOptions();
   updateShowTouchesOptions();
   updateFlingerOptions();
   updateCpuUsageOptions();
   updateHardwareUiOptions();
   updateMsaaOptions();
   updateTrackFrameTimeOptions();
   updateShowHwScreenUpdatesOptions();
   updateShowHwLayersUpdatesOptions();
   updateShowHwOverdrawOptions();
   updateDebugLayoutOptions();
   updateAnimationScaleOptions();
   updateOverlayDisplayDevicesOptions();
   updateOpenGLTracesOptions();
   updateEnableTracesOptions();
   updateImmediatelyDestroyActivitiesOptions();
   updateAppProcessLimitOptions();
   updateShowAllANRsOptions();
   updateVerifyAppsOverUsbOptions();
   updateBugreportOptions();
 }
 private void updateStrictModeVisualOptions() {
   updateCheckBox(mStrictMode, currentStrictModeActiveIndex() == 1);
 }
 private void updateMsaaOptions() {
   updateCheckBox(mForceMsaa, SystemProperties.getBoolean(MSAA_PROPERTY, false));
 }
 private void updateDebugLayoutOptions() {
   updateCheckBox(mDebugLayout, SystemProperties.getBoolean(View.DEBUG_LAYOUT_PROPERTY, false));
 }
 private void updateShowTouchesOptions() {
   updateCheckBox(
       mShowTouches,
       Settings.System.getInt(getActivity().getContentResolver(), Settings.System.SHOW_TOUCHES, 0)
           != 0);
 }
 private void updateShowHwOverdrawOptions() {
   updateCheckBox(
       mShowHwOverdraw,
       SystemProperties.getBoolean(HardwareRenderer.DEBUG_SHOW_OVERDRAW_PROPERTY, false));
 }
 private void updateShowHwLayersUpdatesOptions() {
   updateCheckBox(
       mShowHwLayersUpdates,
       SystemProperties.getBoolean(HardwareRenderer.DEBUG_SHOW_LAYERS_UPDATES_PROPERTY, false));
 }
 private void updateShowHwScreenUpdatesOptions() {
   updateCheckBox(
       mShowHwScreenUpdates,
       SystemProperties.getBoolean(HardwareRenderer.DEBUG_DIRTY_REGIONS_PROPERTY, false));
 }
 private void updateTrackFrameTimeOptions() {
   updateCheckBox(
       mTrackFrameTime, SystemProperties.getBoolean(HardwareRenderer.PROFILE_PROPERTY, false));
 }
 private void updateHardwareUiOptions() {
   updateCheckBox(mForceHardwareUi, SystemProperties.getBoolean(HARDWARE_UI_PROPERTY, false));
 }