migrate custom widgets in comply with plugin framework

Bug: 139888225
Change-Id: I8a3d0fe2689ad5ba24b19309728bbad0b6287f71
Merged-In: I8a3d0fe2689ad5ba24b19309728bbad0b6287f71
(cherry picked from commit c7a6c2979c)
This commit is contained in:
Pinyao Ting committed 2019-09-25 15:58:41 -07:00
1 parent 0b72d6a891
commit 59e908b54f
13 files changed
+286 -241

No files matched your search

@@ -23,19 +23,18 @@ import android.content.Context;
import android.os.Bundle;
import android.os.UserHandle;
import androidx.annotation.Nullable;
import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherAppWidgetProviderInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.widget.custom.CustomWidgetParser;
import com.android.launcher3.widget.custom.CustomWidgetManager;
import java.util.HashMap;
import java.util.List;
import androidx.annotation.Nullable;
public abstract class AppWidgetManagerCompat {
private static final Object sInstanceLock = new Object();
@@ -63,11 +62,9 @@ public abstract class AppWidgetManagerCompat {
}
public LauncherAppWidgetProviderInfo getLauncherAppWidgetInfo(int appWidgetId) {
if (FeatureFlags.ENABLE_CUSTOM_WIDGETS
&& appWidgetId <= LauncherAppWidgetInfo.CUSTOM_WIDGET_ID) {
return CustomWidgetParser.getWidgetProvider(mContext, appWidgetId);
if (appWidgetId <= LauncherAppWidgetInfo.CUSTOM_WIDGET_ID) {
return CustomWidgetManager.INSTANCE.get(mContext).getWidgetProvider(appWidgetId);
}
AppWidgetProviderInfo info = mAppWidgetManager.getAppWidgetInfo(appWidgetId);
return info == null ? null : LauncherAppWidgetProviderInfo.fromProviderInfo(mContext, info);
}