diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/DevelopmentSettings.java | 16 | ||||
-rw-r--r-- | src/com/android/settings/DisplaySettings.java | 9 | ||||
-rw-r--r-- | src/com/android/settings/DreamBackend.java | 17 | ||||
-rw-r--r-- | src/com/android/settings/DreamSettings.java | 14 | ||||
-rw-r--r-- | src/com/android/settings/LocalePicker.java | 1 | ||||
-rw-r--r-- | src/com/android/settings/SecuritySettings.java | 31 | ||||
-rw-r--r-- | src/com/android/settings/Settings.java | 4 | ||||
-rw-r--r-- | src/com/android/settings/applications/InstalledAppDetails.java | 126 |
8 files changed, 170 insertions, 48 deletions
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java index d1f9b55..0ad6a91 100644 --- a/src/com/android/settings/DevelopmentSettings.java +++ b/src/com/android/settings/DevelopmentSettings.java @@ -93,6 +93,7 @@ public class DevelopmentSettings extends PreferenceFragment private static final String ENFORCE_READ_EXTERNAL = "enforce_read_external"; private static final String LOCAL_BACKUP_PASSWORD = "local_backup_password"; private static final String HARDWARE_UI_PROPERTY = "persist.sys.ui.hw"; + private static final String MSAA_PROPERTY = "debug.egl.force_msaa"; private static final String BUGREPORT_IN_POWER_KEY = "bugreport_in_power"; private static final String DEBUG_APP_KEY = "debug_app"; @@ -105,6 +106,7 @@ public class DevelopmentSettings extends PreferenceFragment private static final String DISABLE_OVERLAYS_KEY = "disable_overlays"; private static final String SHOW_CPU_USAGE_KEY = "show_cpu_usage"; private static final String FORCE_HARDWARE_UI_KEY = "force_hw_ui"; + private static final String FORCE_MSAA_KEY = "force_msaa"; private static final String TRACK_FRAME_TIME_KEY = "track_frame_time"; private static final String SHOW_HW_SCREEN_UPDATES_KEY = "show_hw_screen_udpates"; private static final String SHOW_HW_LAYERS_UPDATES_KEY = "show_hw_layers_udpates"; @@ -158,6 +160,7 @@ public class DevelopmentSettings extends PreferenceFragment private CheckBoxPreference mDisableOverlays; private CheckBoxPreference mShowCpuUsage; private CheckBoxPreference mForceHardwareUi; + private CheckBoxPreference mForceMsaa; private CheckBoxPreference mTrackFrameTime; private CheckBoxPreference mShowHwScreenUpdates; private CheckBoxPreference mShowHwLayersUpdates; @@ -224,6 +227,7 @@ public class DevelopmentSettings extends PreferenceFragment 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); @@ -393,6 +397,7 @@ public class DevelopmentSettings extends PreferenceFragment updateFlingerOptions(); updateCpuUsageOptions(); updateHardwareUiOptions(); + updateMsaaOptions(); updateTrackFrameTimeOptions(); updateShowHwScreenUpdatesOptions(); updateShowHwLayersUpdatesOptions(); @@ -650,6 +655,15 @@ public class DevelopmentSettings extends PreferenceFragment pokeSystemProperties(); } + private void updateMsaaOptions() { + updateCheckBox(mForceMsaa, SystemProperties.getBoolean(MSAA_PROPERTY, false)); + } + + private void writeMsaaOptions() { + SystemProperties.set(MSAA_PROPERTY, mForceMsaa.isChecked() ? "true" : "false"); + pokeSystemProperties(); + } + private void updateTrackFrameTimeOptions() { updateCheckBox(mTrackFrameTime, SystemProperties.getBoolean(HardwareRenderer.PROFILE_PROPERTY, false)); @@ -987,6 +1001,8 @@ public class DevelopmentSettings extends PreferenceFragment writeShowAllANRsOptions(); } else if (preference == mForceHardwareUi) { writeHardwareUiOptions(); + } else if (preference == mForceMsaa) { + writeMsaaOptions(); } else if (preference == mTrackFrameTime) { writeTrackFrameTimeOptions(); } else if (preference == mShowHwScreenUpdates) { diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java index a698538..6ee60b5 100644 --- a/src/com/android/settings/DisplaySettings.java +++ b/src/com/android/settings/DisplaySettings.java @@ -284,11 +284,10 @@ public class DisplaySettings extends SettingsPreferenceFragment implements } private void updateScreenSaverSummary() { - int summaryResId = DreamSettings.getSummaryResource(getActivity()); - if (summaryResId > 0) - mScreenSaverPreference.setSummary(summaryResId); - else - mScreenSaverPreference.setSummary(""); + if (mScreenSaverPreference != null) { + mScreenSaverPreference.setSummary( + DreamSettings.getSummaryTextWithDreamName(getActivity())); + } } private void updateWifiDisplaySummary() { diff --git a/src/com/android/settings/DreamBackend.java b/src/com/android/settings/DreamBackend.java index 7effe4b..a866174 100644 --- a/src/com/android/settings/DreamBackend.java +++ b/src/com/android/settings/DreamBackend.java @@ -26,6 +26,7 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.PackageManager.NameNotFoundException; +import android.content.pm.ServiceInfo; import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; @@ -116,6 +117,22 @@ public class DreamBackend { } } + public CharSequence getActiveDreamName() { + ComponentName cn = getActiveDream(); + if (cn != null) { + PackageManager pm = mContext.getPackageManager(); + try { + ServiceInfo ri = pm.getServiceInfo(cn, 0); + if (ri != null) { + return ri.loadLabel(pm); + } + } catch (PackageManager.NameNotFoundException exc) { + return null; // uninstalled? + } + } + return null; + } + public boolean isEnabled() { return getBoolean(SCREENSAVER_ENABLED); } diff --git a/src/com/android/settings/DreamSettings.java b/src/com/android/settings/DreamSettings.java index ca4415b..32328d9 100644 --- a/src/com/android/settings/DreamSettings.java +++ b/src/com/android/settings/DreamSettings.java @@ -149,7 +149,7 @@ public class DreamSettings extends SettingsPreferenceFragment { // create "when to dream" overflow menu item MenuItem whenToDream = createMenuItem(menu, R.string.screensaver_settings_when_to_dream, - MenuItem.SHOW_AS_ACTION_NEVER, + MenuItem.SHOW_AS_ACTION_IF_ROOM, isEnabled, new Runnable() { @Override @@ -245,6 +245,16 @@ public class DreamSettings extends SettingsPreferenceFragment { : 0; } + public static CharSequence getSummaryTextWithDreamName(Context context) { + DreamBackend backend = new DreamBackend(context); + boolean isEnabled = backend.isEnabled(); + if (!isEnabled) { + return context.getString(R.string.screensaver_settings_summary_off); + } else { + return backend.getActiveDreamName(); + } + } + private void refreshFromBackend() { logd("refreshFromBackend()"); mRefreshing = true; @@ -306,7 +316,7 @@ public class DreamSettings extends SettingsPreferenceFragment { ImageView settingsButton = (ImageView) row.findViewById(android.R.id.button2); settingsButton.setVisibility(showSettings ? View.VISIBLE : View.INVISIBLE); - settingsButton.setAlpha(dreamInfo.isActive ? 1f : 0.7f); + settingsButton.setAlpha(dreamInfo.isActive ? 1f : 0.33f); settingsButton.setEnabled(dreamInfo.isActive); settingsButton.setOnClickListener(new OnClickListener(){ @Override diff --git a/src/com/android/settings/LocalePicker.java b/src/com/android/settings/LocalePicker.java index 0afa4d5..9bfa07e 100644 --- a/src/com/android/settings/LocalePicker.java +++ b/src/com/android/settings/LocalePicker.java @@ -55,6 +55,7 @@ public class LocalePicker extends com.android.internal.app.LocalePicker mTargetLocale = locale; showDialog(DLG_SHOW_GLOBAL_WARNING); } else { + getActivity().onBackPressed(); LocalePicker.updateLocale(locale); } } diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java index aed6cf3..13b1d0d 100644 --- a/src/com/android/settings/SecuritySettings.java +++ b/src/com/android/settings/SecuritySettings.java @@ -39,6 +39,7 @@ import android.preference.CheckBoxPreference; import android.preference.ListPreference; import android.preference.Preference; import android.preference.Preference.OnPreferenceChangeListener; +import android.preference.PreferenceCategory; import android.preference.PreferenceGroup; import android.preference.PreferenceScreen; import android.provider.Settings; @@ -98,7 +99,6 @@ public class SecuritySettings extends SettingsPreferenceFragment DevicePolicyManager mDPM; private ChooseLockSettingsHelper mChooseLockSettingsHelper; - private Preference mUserSelectedWidget; private LockPatternUtils mLockPatternUtils; private ListPreference mLockAfter; @@ -220,32 +220,45 @@ public class SecuritySettings extends SettingsPreferenceFragment } } - mUserSelectedWidget = root.findPreference(KEY_CHOOSE_LOCKSCREEN_STATUS_WIDGET); - if (mUserSelectedWidget != null) { + Preference pickStatusWidget = root.findPreference(KEY_CHOOSE_LOCKSCREEN_STATUS_WIDGET); + if (pickStatusWidget != null) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(getActivity()); int appWidgetId = getStatusAppWidgetId(); if (appWidgetId == -1) { - mUserSelectedWidget.setSummary(getResources().getString(R.string.widget_default)); + pickStatusWidget.setSummary(getResources().getString(R.string.widget_default)); } else { AppWidgetProviderInfo appWidget = appWidgetManager.getAppWidgetInfo(appWidgetId); if (appWidget != null) { - mUserSelectedWidget.setSummary(appWidget.label); + pickStatusWidget.setSummary(appWidget.label); } } + // TEMP: disable this for now + PreferenceCategory security = + (PreferenceCategory) root.findPreference(KEY_SECURITY_CATEGORY); + if (security != null) { + security.removePreference(pickStatusWidget); + } } - mUserSelectedWidget = root.findPreference(KEY_CHOOSE_USER_SELECTED_LOCKSCREEN_WIDGET); - if (mUserSelectedWidget != null) { + Preference pickLockscreenWidget = + root.findPreference(KEY_CHOOSE_USER_SELECTED_LOCKSCREEN_WIDGET); + if (pickLockscreenWidget != null) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(getActivity()); int appWidgetId = getUserSelectedAppWidgetId(); if (appWidgetId == -1) { - mUserSelectedWidget.setSummary(getResources().getString(R.string.widget_none)); + pickLockscreenWidget.setSummary(getResources().getString(R.string.widget_none)); } else { AppWidgetProviderInfo appWidget = appWidgetManager.getAppWidgetInfo(appWidgetId); if (appWidget != null) { - mUserSelectedWidget.setSummary(appWidget.label); + pickLockscreenWidget.setSummary(appWidget.label); } } + // TEMP: disable this for now + PreferenceCategory security = + (PreferenceCategory) root.findPreference(KEY_SECURITY_CATEGORY); + if (security != null) { + security.removePreference(pickLockscreenWidget); + } } // Append the rest of the settings diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java index 2d16262..f045db0 100644 --- a/src/com/android/settings/Settings.java +++ b/src/com/android/settings/Settings.java @@ -17,6 +17,7 @@ package com.android.settings; import com.android.internal.util.ArrayUtils; +import com.android.settings.ChooseLockGeneric.ChooseLockGenericFragment; import com.android.settings.accounts.AccountSyncSettings; import com.android.settings.accounts.AuthenticatorHelper; import com.android.settings.accounts.ManageAccountsSettings; @@ -391,7 +392,8 @@ public class Settings extends PreferenceActivity ManageAccountsSettings.class.getName().equals(fragmentName) || VpnSettings.class.getName().equals(fragmentName) || SecuritySettings.class.getName().equals(fragmentName) || - InstalledAppDetails.class.getName().equals(fragmentName)) { + InstalledAppDetails.class.getName().equals(fragmentName) || + ChooseLockGenericFragment.class.getName().equals(fragmentName)) { intent.putExtra(EXTRA_CLEAR_UI_OPTIONS, true); } diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java index 1cdb4dc..acb669e 100644 --- a/src/com/android/settings/applications/InstalledAppDetails.java +++ b/src/com/android/settings/applications/InstalledAppDetails.java @@ -116,6 +116,8 @@ public class InstalledAppDetails extends Fragment private CanBeOnSdCardChecker mCanBeOnSdCardChecker; private View mRootView; private Button mUninstallButton; + private View mMoreControlButtons; + private Button mSpecialDisableButton; private boolean mMoveInProgress = false; private boolean mUpdatedSysApp = false; private Button mActivitiesButton; @@ -140,7 +142,9 @@ public class InstalledAppDetails extends Fragment private CompoundButton mNotificationSwitch; private PackageMoveObserver mPackageMoveObserver; - + + private boolean mDisableAfterUninstall; + private boolean mHaveSizes = false; private long mLastCodeSize = -1; private long mLastDataSize = -1; @@ -174,6 +178,7 @@ public class InstalledAppDetails extends Fragment private static final int DLG_MOVE_FAILED = DLG_BASE + 6; private static final int DLG_DISABLE = DLG_BASE + 7; private static final int DLG_DISABLE_NOTIFICATIONS = DLG_BASE + 8; + private static final int DLG_SPECIAL_DISABLE = DLG_BASE + 9; // Menu identifiers public static final int UNINSTALL_ALL_USERS_MENU = 1; @@ -309,37 +314,49 @@ public class InstalledAppDetails extends Fragment } } + private boolean handleDisableable(Button button) { + boolean disableable = false; + try { + // Try to prevent the user from bricking their phone + // by not allowing disabling of apps signed with the + // system cert and any launcher app in the system. + PackageInfo sys = mPm.getPackageInfo("android", + PackageManager.GET_SIGNATURES); + Intent intent = new Intent(Intent.ACTION_MAIN); + intent.addCategory(Intent.CATEGORY_HOME); + intent.setPackage(mAppEntry.info.packageName); + List<ResolveInfo> homes = mPm.queryIntentActivities(intent, 0); + if ((homes != null && homes.size() > 0) || isThisASystemPackage()) { + // Disable button for core system applications. + button.setText(R.string.disable_text); + } else if (mAppEntry.info.enabled) { + button.setText(R.string.disable_text); + disableable = true; + } else { + button.setText(R.string.enable_text); + disableable = true; + } + } catch (PackageManager.NameNotFoundException e) { + Log.w(TAG, "Unable to get package info", e); + } + return disableable; + } + private void initUninstallButtons() { mUpdatedSysApp = (mAppEntry.info.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0; boolean enabled = true; if (mUpdatedSysApp) { mUninstallButton.setText(R.string.app_factory_reset); + boolean specialDisable = false; + if ((mAppEntry.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { + specialDisable = handleDisableable(mSpecialDisableButton); + mSpecialDisableButton.setOnClickListener(this); + } + mMoreControlButtons.setVisibility(specialDisable ? View.VISIBLE : View.GONE); } else { + mMoreControlButtons.setVisibility(View.GONE); if ((mAppEntry.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { - enabled = false; - try { - // Try to prevent the user from bricking their phone - // by not allowing disabling of apps signed with the - // system cert and any launcher app in the system. - PackageInfo sys = mPm.getPackageInfo("android", - PackageManager.GET_SIGNATURES); - Intent intent = new Intent(Intent.ACTION_MAIN); - intent.addCategory(Intent.CATEGORY_HOME); - intent.setPackage(mAppEntry.info.packageName); - List<ResolveInfo> homes = mPm.queryIntentActivities(intent, 0); - if ((homes != null && homes.size() > 0) || isThisASystemPackage()) { - // Disable button for core system applications. - mUninstallButton.setText(R.string.disable_text); - } else if (mAppEntry.info.enabled) { - mUninstallButton.setText(R.string.disable_text); - enabled = true; - } else { - mUninstallButton.setText(R.string.enable_text); - enabled = true; - } - } catch (PackageManager.NameNotFoundException e) { - Log.w(TAG, "Unable to get package info", e); - } + enabled = handleDisableable(mUninstallButton); } else if ((mPackageInfo.applicationInfo.flags & ApplicationInfo.FLAG_INSTALLED) == 0) { mUninstallButton.setText(R.string.uninstall_text); @@ -428,6 +445,12 @@ public class InstalledAppDetails extends Fragment mUninstallButton = (Button)btnPanel.findViewById(R.id.right_button); mForceStopButton.setEnabled(false); + // Get More Control button panel + mMoreControlButtons = view.findViewById(R.id.more_control_buttons_panel); + mMoreControlButtons.findViewById(R.id.left_button).setVisibility(View.INVISIBLE); + mSpecialDisableButton = (Button)mMoreControlButtons.findViewById(R.id.right_button); + mMoreControlButtons.setVisibility(View.GONE); + // Initialize clear data and move install location buttons View data_buttons_panel = view.findViewById(R.id.data_buttons_panel); mClearDataButton = (Button) data_buttons_panel.findViewById(R.id.right_button); @@ -468,7 +491,7 @@ public class InstalledAppDetails extends Fragment showIt = false; } else if (UserHandle.myUserId() != 0) { showIt = false; - } else if (mUserManager.getUsers().size() < 1) { + } else if (mUserManager.getUsers().size() < 2) { showIt = false; } menu.findItem(UNINSTALL_ALL_USERS_MENU).setVisible(showIt); @@ -478,7 +501,7 @@ public class InstalledAppDetails extends Fragment public boolean onOptionsItemSelected(MenuItem item) { int menuId = item.getItemId(); if (menuId == UNINSTALL_ALL_USERS_MENU) { - uninstallPkg(mAppEntry.info.packageName, true); + uninstallPkg(mAppEntry.info.packageName, true, false); return true; } return false; @@ -488,6 +511,20 @@ public class InstalledAppDetails extends Fragment public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_UNINSTALL) { + if (mDisableAfterUninstall) { + mDisableAfterUninstall = false; + try { + ApplicationInfo ainfo = getActivity().getPackageManager().getApplicationInfo( + mAppEntry.info.packageName, PackageManager.GET_UNINSTALLED_PACKAGES + | PackageManager.GET_DISABLED_COMPONENTS); + if ((ainfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) == 0) { + new DisableChanger(this, mAppEntry.info, + PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER) + .execute((Object)null); + } + } catch (NameNotFoundException e) { + } + } if (!refreshUi()) { setIntentAndFinish(true, true); } @@ -777,7 +814,14 @@ public class InstalledAppDetails extends Fragment } else if (!mShowUninstalled) { // All other times: if we did not start out with the app uninstalled, // then if it becomes uninstalled we want to go away. - return (mAppEntry.info.flags&ApplicationInfo.FLAG_INSTALLED) == 0; + try { + ApplicationInfo ainfo = getActivity().getPackageManager().getApplicationInfo( + mAppEntry.info.packageName, PackageManager.GET_UNINSTALLED_PACKAGES + | PackageManager.GET_DISABLED_COMPONENTS); + return (ainfo.flags&ApplicationInfo.FLAG_INSTALLED) != 0; + } catch (NameNotFoundException e) { + return false; + } } return true; @@ -924,6 +968,7 @@ public class InstalledAppDetails extends Fragment mMoveAppButton.setText(R.string.moving); mMoveAppButton.setEnabled(false); mUninstallButton.setEnabled(false); + mSpecialDisableButton.setEnabled(false); } } @@ -1015,7 +1060,8 @@ public class InstalledAppDetails extends Fragment new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Clear user data here - getOwner().uninstallPkg(getOwner().mAppEntry.info.packageName, false); + getOwner().uninstallPkg(getOwner().mAppEntry.info.packageName, + false, false); } }) .setNegativeButton(R.string.dlg_cancel, null) @@ -1106,17 +1152,33 @@ public class InstalledAppDetails extends Fragment } }) .create(); + case DLG_SPECIAL_DISABLE: + return new AlertDialog.Builder(getActivity()) + .setTitle(getActivity().getText(R.string.app_special_disable_dlg_title)) + .setIconAttribute(android.R.attr.alertDialogIcon) + .setMessage(getActivity().getText(R.string.app_special_disable_dlg_text)) + .setPositiveButton(R.string.dlg_ok, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + // Clear user data here + getOwner().uninstallPkg(getOwner().mAppEntry.info.packageName, + false, true); + } + }) + .setNegativeButton(R.string.dlg_cancel, null) + .create(); } throw new IllegalArgumentException("unknown id " + id); } } - private void uninstallPkg(String packageName, boolean allUsers) { + private void uninstallPkg(String packageName, boolean allUsers, boolean andDisable) { // Create new intent to launch Uninstaller activity Uri packageURI = Uri.parse("package:"+packageName); Intent uninstallIntent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageURI); uninstallIntent.putExtra(Intent.EXTRA_UNINSTALL_ALL_USERS, allUsers); startActivityForResult(uninstallIntent, REQUEST_UNINSTALL); + mDisableAfterUninstall = andDisable; } private void forceStopPackage(String pkgName) { @@ -1230,9 +1292,11 @@ public class InstalledAppDetails extends Fragment } catch (NameNotFoundException e) { } } else { - uninstallPkg(packageName, false); + uninstallPkg(packageName, false, false); } } + } else if(v == mSpecialDisableButton) { + showDialogInner(DLG_SPECIAL_DISABLE, 0); } else if(v == mActivitiesButton) { mPm.clearPackagePreferredActivities(packageName); try { |