Merge "Passing bind options to the service in the bind-widget permission prompt"

This commit is contained in:
Sunny Goyal
2017-01-27 17:59:54 +00:00
committed by Android (Google) Code Review

View File

@@ -42,6 +42,7 @@ public class AllowBindAppWidgetActivity extends AlertActivity implements
private CheckBox mAlwaysUse; private CheckBox mAlwaysUse;
private int mAppWidgetId; private int mAppWidgetId;
private Bundle mBindOptions;
private UserHandle mProfile; private UserHandle mProfile;
private ComponentName mComponentName; private ComponentName mComponentName;
private String mCallingPackage; private String mCallingPackage;
@@ -57,7 +58,7 @@ public class AllowBindAppWidgetActivity extends AlertActivity implements
if (mAppWidgetId != -1 && mComponentName != null && mCallingPackage != null) { if (mAppWidgetId != -1 && mComponentName != null && mCallingPackage != null) {
try { try {
final boolean bound = mAppWidgetManager.bindAppWidgetIdIfAllowed(mAppWidgetId, final boolean bound = mAppWidgetManager.bindAppWidgetIdIfAllowed(mAppWidgetId,
mProfile, mComponentName, null); mProfile, mComponentName, mBindOptions);
if (bound) { if (bound) {
Intent result = new Intent(); Intent result = new Intent();
result.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId); result.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);
@@ -100,6 +101,8 @@ public class AllowBindAppWidgetActivity extends AlertActivity implements
} }
mComponentName = mComponentName =
intent.getParcelableExtra(AppWidgetManager.EXTRA_APPWIDGET_PROVIDER); intent.getParcelableExtra(AppWidgetManager.EXTRA_APPWIDGET_PROVIDER);
mBindOptions =
intent.getParcelableExtra(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS);
mCallingPackage = getCallingPackage(); mCallingPackage = getCallingPackage();
PackageManager pm = getPackageManager(); PackageManager pm = getPackageManager();
ApplicationInfo ai = pm.getApplicationInfo(mCallingPackage, 0); ApplicationInfo ai = pm.getApplicationInfo(mCallingPackage, 0);