diff options
Diffstat (limited to 'src')
7 files changed, 40 insertions, 34 deletions
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java index 8765dfb..af03549 100644 --- a/src/com/android/settings/applications/InstalledAppDetails.java +++ b/src/com/android/settings/applications/InstalledAppDetails.java @@ -69,6 +69,7 @@ import android.widget.TextView; public class InstalledAppDetails extends Activity implements View.OnClickListener, ApplicationsState.Callbacks { private static final String TAG="InstalledAppDetails"; + static final boolean SUPPORT_DISABLE_APPS = false; private PackageManager mPm; private ApplicationsState mState; @@ -259,30 +260,32 @@ public class InstalledAppDetails extends Activity } else { 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) || - (mPackageInfo != null && - sys.signatures[0].equals(mPackageInfo.signatures[0]))) { - // 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; + if (SUPPORT_DISABLE_APPS) { + 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) || + (mPackageInfo != null && + sys.signatures[0].equals(mPackageInfo.signatures[0]))) { + // 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); } - } catch (PackageManager.NameNotFoundException e) { - Log.w(TAG, "Unable to get package info", e); } } else { mUninstallButton.setText(R.string.uninstall_text); diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java index 772e48d..34e0e8e 100644 --- a/src/com/android/settings/applications/ManageApplications.java +++ b/src/com/android/settings/applications/ManageApplications.java @@ -354,7 +354,11 @@ public class ManageApplications extends TabActivity implements holder.appIcon.setImageDrawable(entry.icon); } holder.updateSizeText(ManageApplications.this); - holder.disabled.setVisibility(entry.info.enabled ? View.GONE : View.VISIBLE); + if (InstalledAppDetails.SUPPORT_DISABLE_APPS) { + holder.disabled.setVisibility(entry.info.enabled ? View.GONE : View.VISIBLE); + } else { + holder.disabled.setVisibility(View.GONE); + } } mActive.remove(convertView); mActive.add(convertView); diff --git a/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java b/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java index eec0ad8..37e48ff 100644 --- a/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java +++ b/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java @@ -144,7 +144,7 @@ public class BluetoothDiscoverableEnabler implements Preference.OnPreferenceChan private void persistDiscoverableEndTimestamp(long endTimestamp) { SharedPreferences.Editor editor = mLocalManager.getSharedPreferences().edit(); editor.putLong(SHARED_PREFERENCES_KEY_DISCOVERABLE_END_TIMESTAMP, endTimestamp); - editor.commit(); + editor.apply(); } private void handleModeChanged(int mode) { diff --git a/src/com/android/settings/bluetooth/BluetoothEventRedirector.java b/src/com/android/settings/bluetooth/BluetoothEventRedirector.java index dbdf6c1..cc3db6e 100644 --- a/src/com/android/settings/bluetooth/BluetoothEventRedirector.java +++ b/src/com/android/settings/bluetooth/BluetoothEventRedirector.java @@ -199,6 +199,6 @@ public class BluetoothEventRedirector { SharedPreferences.Editor editor = mManager.getSharedPreferences().edit(); editor.putLong(LocalBluetoothManager.SHARED_PREFERENCES_KEY_DISCOVERING_TIMESTAMP, System.currentTimeMillis()); - editor.commit(); + editor.apply(); } } diff --git a/src/com/android/settings/bluetooth/DockService.java b/src/com/android/settings/bluetooth/DockService.java index d0f8099..db24554 100644 --- a/src/com/android/settings/bluetooth/DockService.java +++ b/src/com/android/settings/bluetooth/DockService.java @@ -788,14 +788,14 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli SharedPreferences.Editor editor = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE).edit(); editor.putBoolean(key, bool); - editor.commit(); + editor.apply(); } private void setSettingInt(String key, int value) { SharedPreferences.Editor editor = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE).edit(); editor.putInt(key, value); - editor.commit(); + editor.apply(); } private void removeSetting(String key) { @@ -803,8 +803,7 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.remove(key); - editor.commit(); - return; + editor.apply(); } public synchronized void onServiceConnected() { diff --git a/src/com/android/settings/bluetooth/LocalBluetoothManager.java b/src/com/android/settings/bluetooth/LocalBluetoothManager.java index 2ffb139..97e823e 100644 --- a/src/com/android/settings/bluetooth/LocalBluetoothManager.java +++ b/src/com/android/settings/bluetooth/LocalBluetoothManager.java @@ -356,7 +356,7 @@ public class LocalBluetoothManager { deviceAddress); editor.putLong(LocalBluetoothManager.SHARED_PREFERENCES_KEY_LAST_SELECTED_DEVICE_TIME, System.currentTimeMillis()); - editor.commit(); + editor.apply(); } public boolean hasDockAutoConnectSetting(String addr) { @@ -371,12 +371,12 @@ public class LocalBluetoothManager { public void saveDockAutoConnectSetting(String addr, boolean autoConnect) { SharedPreferences.Editor editor = getSharedPreferences().edit(); editor.putBoolean(SHARED_PREFERENCES_KEY_DOCK_AUTO_CONNECT + addr, autoConnect); - editor.commit(); + editor.apply(); } public void removeDockAutoConnectSetting(String addr) { SharedPreferences.Editor editor = getSharedPreferences().edit(); editor.remove(SHARED_PREFERENCES_KEY_DOCK_AUTO_CONNECT + addr); - editor.commit(); + editor.apply(); } } diff --git a/src/com/android/settings/bluetooth/RequestPermissionActivity.java b/src/com/android/settings/bluetooth/RequestPermissionActivity.java index eca233c..dd802f3 100644 --- a/src/com/android/settings/bluetooth/RequestPermissionActivity.java +++ b/src/com/android/settings/bluetooth/RequestPermissionActivity.java @@ -277,7 +277,7 @@ public class RequestPermissionActivity extends Activity implements editor.putLong( BluetoothDiscoverableEnabler.SHARED_PREFERENCES_KEY_DISCOVERABLE_END_TIMESTAMP, endTimestamp); - editor.commit(); + editor.apply(); } @Override |