From 64a75aa305bdd1ca8f22d2b48dedc5cada8fabc5 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 3 Jul 2017 13:50:52 -0700 Subject: Adding A feature flag to disable widgets and a corresponding build target Launcher3Go without widgets support Bug: 62353159 Change-Id: Ia03d2235a9bcf75f9ef191924f81630e63a2c684 --- .../android/launcher3/widget/WidgetAddFlowHandler.java | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src/com/android/launcher3/widget/WidgetAddFlowHandler.java') diff --git a/src/com/android/launcher3/widget/WidgetAddFlowHandler.java b/src/com/android/launcher3/widget/WidgetAddFlowHandler.java index 629f30c26..5387be839 100644 --- a/src/com/android/launcher3/widget/WidgetAddFlowHandler.java +++ b/src/com/android/launcher3/widget/WidgetAddFlowHandler.java @@ -15,10 +15,8 @@ */ package com.android.launcher3.widget; -import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProviderInfo; import android.content.Context; -import android.content.Intent; import android.os.Parcel; import android.os.Parcelable; @@ -26,7 +24,6 @@ import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherAppWidgetProviderInfo; -import com.android.launcher3.compat.AppWidgetManagerCompat; import com.android.launcher3.util.PendingRequestArgs; /** @@ -56,15 +53,8 @@ public class WidgetAddFlowHandler implements Parcelable { public void startBindFlow(Launcher launcher, int appWidgetId, ItemInfo info, int requestCode) { launcher.setWaitingForResult(PendingRequestArgs.forWidgetInfo(appWidgetId, this, info)); - - Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_BIND); - intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); - intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_PROVIDER, mProviderInfo.provider); - intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_PROVIDER_PROFILE, - mProviderInfo.getProfile()); - // TODO: we need to make sure that this accounts for the options bundle. - // intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS, options); - launcher.startActivityForResult(intent, requestCode); + launcher.getAppWidgetHost() + .startBindFlow(launcher, appWidgetId, mProviderInfo, requestCode); } /** @@ -85,9 +75,7 @@ public class WidgetAddFlowHandler implements Parcelable { return false; } launcher.setWaitingForResult(PendingRequestArgs.forWidgetInfo(appWidgetId, this, info)); - - AppWidgetManagerCompat.getInstance(launcher).startConfigActivity( - mProviderInfo, appWidgetId, launcher, launcher.getAppWidgetHost(), requestCode); + launcher.getAppWidgetHost().startConfigActivity(launcher, appWidgetId, requestCode); return true; } -- cgit v1.2.3