am ab3472f5: Supporting EXTRA_APPWIDGET_OPTIONS correctly

* commit 'ab3472f5946c5dc3193c29513e31be7309ece378':
  Supporting EXTRA_APPWIDGET_OPTIONS correctly
This commit is contained in:
Michael Jurka
2012-11-06 12:38:24 -08:00
committed by Android Git Automerger

View File

@@ -84,6 +84,7 @@ public class KeyguardAppWidgetPickActivity extends Activity
private Intent mResultData; private Intent mResultData;
private LockPatternUtils mLockPatternUtils; private LockPatternUtils mLockPatternUtils;
private boolean mSuccess; private boolean mSuccess;
private Bundle mExtraConfigureOptions;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@@ -101,6 +102,7 @@ public class KeyguardAppWidgetPickActivity extends Activity
} else { } else {
finish(); finish();
} }
mExtraConfigureOptions = intent.getBundleExtra(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS);
mGridView = (GridView) findViewById(R.id.widget_list); mGridView = (GridView) findViewById(R.id.widget_list);
mAppWidgetManager = AppWidgetManager.getInstance(this); mAppWidgetManager = AppWidgetManager.getInstance(this);
@@ -466,12 +468,8 @@ public class KeyguardAppWidgetPickActivity extends Activity
setResultData(result, intent); setResultData(result, intent);
} else { } else {
try { try {
Bundle options = null; mAppWidgetManager.bindAppWidgetId(
if (intent.getExtras() != null) { mAppWidgetId, intent.getComponent(), mExtraConfigureOptions);
options = intent.getExtras().getBundle(
AppWidgetManager.EXTRA_APPWIDGET_OPTIONS);
}
mAppWidgetManager.bindAppWidgetId(mAppWidgetId, intent.getComponent(), options);
result = RESULT_OK; result = RESULT_OK;
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
// This is thrown if they're already bound, or otherwise somehow // This is thrown if they're already bound, or otherwise somehow