Adding A feature flag to disable widgets and a corresponding build

target Launcher3Go without widgets support

Bug: 62353159
Change-Id: Ia03d2235a9bcf75f9ef191924f81630e63a2c684
This commit is contained in:
Sunny Goyal
2017-07-03 13:50:52 -07:00
parent 70999fef4b
commit 64a75aa305
22 changed files with 473 additions and 97 deletions

View File

@@ -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;
}