Merge "move remaining dock settings into sound settings fragment." into jb-mr1-dev
diff --git a/src/com/android/settings/AppWidgetPickActivity.java b/src/com/android/settings/AppWidgetPickActivity.java
index f242dcf..a475649 100644
--- a/src/com/android/settings/AppWidgetPickActivity.java
+++ b/src/com/android/settings/AppWidgetPickActivity.java
@@ -143,15 +143,22 @@
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = getIntentForPosition(which);
-
+
int result;
- if (intent.getExtras() != null) {
- // If there are any extras, it's because this entry is custom.
+ if (intent.getExtras() != null &&
+ (intent.getExtras().containsKey(AppWidgetManager.EXTRA_CUSTOM_INFO) ||
+ intent.getExtras().containsKey(AppWidgetManager.EXTRA_CUSTOM_EXTRAS))) {
+ // If these extras are present it's because this entry is custom.
// Don't try to bind it, just pass it back to the app.
setResultData(RESULT_OK, intent);
} else {
try {
- mAppWidgetManager.bindAppWidgetId(mAppWidgetId, intent.getComponent());
+ Bundle options = null;
+ if (intent.getExtras() != null) {
+ options = intent.getExtras().getBundle(
+ AppWidgetManager.EXTRA_APPWIDGET_OPTIONS);
+ }
+ mAppWidgetManager.bindAppWidgetId(mAppWidgetId, intent.getComponent(), options);
result = RESULT_OK;
} catch (IllegalArgumentException e) {
// This is thrown if they're already bound, or otherwise somehow
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index a3f3486..f5d1608 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -475,6 +475,17 @@
}
}
+ private Intent getBaseIntent() {
+ Intent baseIntent = new Intent(Intent.ACTION_MAIN, null);
+ baseIntent.addCategory(Intent.CATEGORY_DEFAULT);
+
+ Bundle options = new Bundle();
+ options.putInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY,
+ AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD);
+ baseIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS, options);
+ return baseIntent;
+ }
+
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
final String key = preference.getKey();
@@ -511,6 +522,7 @@
// Launch the widget picker
pickIntent.putExtra(AppWidgetManager.EXTRA_CUSTOM_INFO, extraInfos);
pickIntent.putExtra(AppWidgetManager.EXTRA_CUSTOM_EXTRAS, extraExtras);
+ pickIntent.putExtra(Intent.EXTRA_INTENT, getBaseIntent());
startActivityForResult(pickIntent, REQUEST_PICK_USER_SELECTED_APPWIDGET);
} else {
Log.e(TAG, "Unable to allocate an AppWidget id in lock screen");
@@ -545,6 +557,7 @@
// Launch the widget picker
pickIntent.putExtra(AppWidgetManager.EXTRA_CUSTOM_INFO, extraInfos);
pickIntent.putExtra(AppWidgetManager.EXTRA_CUSTOM_EXTRAS, extraExtras);
+ pickIntent.putExtra(Intent.EXTRA_INTENT, getBaseIntent());
startActivityForResult(pickIntent, REQUEST_PICK_STATUS_APPWIDGET);
} else {
Log.e(TAG, "Unable to allocate an AppWidget id in lock screen");
diff --git a/src/com/android/settings/vpn2/VpnSettings.java b/src/com/android/settings/vpn2/VpnSettings.java
index 931f0c2..de7c034 100644
--- a/src/com/android/settings/vpn2/VpnSettings.java
+++ b/src/com/android/settings/vpn2/VpnSettings.java
@@ -28,6 +28,7 @@
import android.os.Handler;
import android.os.Message;
import android.os.ServiceManager;
+import android.os.SystemProperties;
import android.preference.Preference;
import android.preference.PreferenceGroup;
import android.security.Credentials;
@@ -105,6 +106,16 @@
}
@Override
+ public void onPrepareOptionsMenu(Menu menu) {
+ super.onPrepareOptionsMenu(menu);
+
+ // Hide lockdown VPN on devices that require IMS authentication
+ if (SystemProperties.getBoolean("persist.radio.imsregrequired", false)) {
+ menu.findItem(R.id.vpn_lockdown).setVisible(false);
+ }
+ }
+
+ @Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.vpn_create: {
diff --git a/src/com/android/settings/widget/SettingsAppWidgetProvider.java b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
index 30ae7c3..a722818 100644
--- a/src/com/android/settings/widget/SettingsAppWidgetProvider.java
+++ b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
@@ -637,23 +637,11 @@
@Override
public void onEnabled(Context context) {
- Class clazz = com.android.settings.widget.SettingsAppWidgetProvider.class;
- PackageManager pm = context.getPackageManager();
- pm.setComponentEnabledSetting(
- new ComponentName(context.getPackageName(), clazz.getName()),
- PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
- PackageManager.DONT_KILL_APP);
checkObserver(context);
}
@Override
public void onDisabled(Context context) {
- Class clazz = com.android.settings.widget.SettingsAppWidgetProvider.class;
- PackageManager pm = context.getPackageManager();
- pm.setComponentEnabledSetting(
- new ComponentName(context.getPackageName(), clazz.getName()),
- PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
- PackageManager.DONT_KILL_APP);
if (sSettingsObserver != null) {
sSettingsObserver.stopObserving();
sSettingsObserver = null;