Merge "Import translations. DO NOT MERGE ANYWHERE" into sc-qpr1-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2263141..594de34 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5197,7 +5197,7 @@
<string name="allow_bind_app_widget_activity_allow_bind_title">Create widget and allow access?</string>
<!-- Message in dialog that pops up when an app requests permission to bind a widget [CHAR LIMIT=NONE] -->
- <string name="allow_bind_app_widget_activity_allow_bind">After you create the widget, <xliff:g id="widget_host_name">%1$s</xliff:g> can access all data it displays.</string>
+ <string name="allow_bind_app_widget_activity_allow_bind">After you create the widget, the application can access everything displayed.\n\nApplication: <xliff:g id="widget_host_name">%1$s</xliff:g>\nWidget: <xliff:g id="widget_label">%2$s</xliff:g>\n</string>
<!-- Text for checkbox that pops up when an app requests permission to bind a widget [CHAR LIMIT=NONE] -->
<string name="allow_bind_app_widget_activity_always_allow_bind">Always allow <xliff:g id="widget_host_name">%1$s</xliff:g> to create widgets and access their data</string>
diff --git a/src/com/android/settings/AllowBindAppWidgetActivity.java b/src/com/android/settings/AllowBindAppWidgetActivity.java
index e7f7a6a..0272c83 100644
--- a/src/com/android/settings/AllowBindAppWidgetActivity.java
+++ b/src/com/android/settings/AllowBindAppWidgetActivity.java
@@ -19,6 +19,7 @@
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import android.appwidget.AppWidgetManager;
+import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
@@ -122,9 +123,12 @@
return;
}
}
+ mAppWidgetManager = AppWidgetManager.getInstance(this);
+ final String widgetLabel = getWidgetLabel();
AlertController.AlertParams ap = mAlertParams;
ap.mTitle = getString(R.string.allow_bind_app_widget_activity_allow_bind_title);
- ap.mMessage = getString(R.string.allow_bind_app_widget_activity_allow_bind, label);
+ ap.mMessage = getString(R.string.allow_bind_app_widget_activity_allow_bind, label,
+ widgetLabel);
ap.mPositiveButtonText = getString(R.string.create);
ap.mNegativeButtonText = getString(android.R.string.cancel);
ap.mPositiveButtonListener = this;
@@ -133,18 +137,30 @@
(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
ap.mView = inflater.inflate(com.android.internal.R.layout.always_use_checkbox, null);
mAlwaysUse = (CheckBox) ap.mView.findViewById(com.android.internal.R.id.alwaysUse);
- mAlwaysUse.setText(getString(R.string.allow_bind_app_widget_activity_always_allow_bind, label));
+ mAlwaysUse.setText(
+ getString(R.string.allow_bind_app_widget_activity_always_allow_bind, label));
mAlwaysUse.setPadding(mAlwaysUse.getPaddingLeft(),
mAlwaysUse.getPaddingTop(),
mAlwaysUse.getPaddingRight(),
(int) (mAlwaysUse.getPaddingBottom() +
- getResources().getDimension(R.dimen.bind_app_widget_dialog_checkbox_bottom_padding)));
+ getResources().getDimension(
+ R.dimen.bind_app_widget_dialog_checkbox_bottom_padding)));
- mAppWidgetManager = AppWidgetManager.getInstance(this);
mAlwaysUse.setChecked(mAppWidgetManager.hasBindAppWidgetPermission(mCallingPackage,
mProfile.getIdentifier()));
setupAlert();
}
+
+ private String getWidgetLabel() {
+ String label = "";
+ for (AppWidgetProviderInfo providerInfo : mAppWidgetManager.getInstalledProviders()) {
+ if (providerInfo.provider.equals(mComponentName)) {
+ label = providerInfo.loadLabel(getPackageManager());
+ break;
+ }
+ }
+ return label;
+ }
}
diff --git a/src/com/android/settings/enterprise/ActionDisabledByAdminDialog.java b/src/com/android/settings/enterprise/ActionDisabledByAdminDialog.java
index ce7ad24..c4bef25 100644
--- a/src/com/android/settings/enterprise/ActionDisabledByAdminDialog.java
+++ b/src/com/android/settings/enterprise/ActionDisabledByAdminDialog.java
@@ -58,11 +58,25 @@
return admin;
}
admin.component = intent.getParcelableExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN);
+ int userId = intent.getIntExtra(Intent.EXTRA_USER_ID, UserHandle.myUserId());
+
+ Bundle adminDetails = null;
+ if (admin.component == null) {
+ DevicePolicyManager devicePolicyManager = getSystemService(DevicePolicyManager.class);
+ adminDetails = devicePolicyManager.getEnforcingAdminAndUserDetails(userId,
+ getRestrictionFromIntent(intent));
+ if (adminDetails != null) {
+ admin.component = adminDetails.getParcelable(
+ DevicePolicyManager.EXTRA_DEVICE_ADMIN);
+ }
+ }
if (intent.hasExtra(Intent.EXTRA_USER)) {
admin.user = intent.getParcelableExtra(Intent.EXTRA_USER);
} else {
- int userId = intent.getIntExtra(Intent.EXTRA_USER_ID, UserHandle.myUserId());
+ if (adminDetails != null) {
+ userId = adminDetails.getInt(Intent.EXTRA_USER_ID, UserHandle.myUserId());
+ }
if (userId == UserHandle.USER_NULL) {
admin.user = null;
} else {