summaryrefslogtreecommitdiffstats
path: root/src_shortcuts_overrides
diff options
context:
space:
mode:
authorRajeev Kumar <rajekumar@google.com>2018-11-05 14:26:26 -0800
committerRajeev Kumar <rajekumar@google.com>2018-11-05 15:43:53 -0800
commit1baf8a78c67b8bc01fb1064f758bda5c4b66ccc6 (patch)
tree577ab55b116f789e1e9d6c84283cb60514e53e39 /src_shortcuts_overrides
parent876e462ffa47d297100a2c8c4427d749e1ed0ed8 (diff)
downloadandroid_packages_apps_Trebuchet-1baf8a78c67b8bc01fb1064f758bda5c4b66ccc6.tar.gz
android_packages_apps_Trebuchet-1baf8a78c67b8bc01fb1064f758bda5c4b66ccc6.tar.bz2
android_packages_apps_Trebuchet-1baf8a78c67b8bc01fb1064f758bda5c4b66ccc6.zip
Create a launcher LoaderResults override.
This change disables shortcuts/widgets binding on Android Go devices. Bug: 112904271 Test: Manual test Change-Id: I3dbcd23dc448ff9ca5fe6c32958dcffb51c4bcf5
Diffstat (limited to 'src_shortcuts_overrides')
-rw-r--r--src_shortcuts_overrides/com/android/launcher3/model/LoaderResults.java67
1 files changed, 67 insertions, 0 deletions
diff --git a/src_shortcuts_overrides/com/android/launcher3/model/LoaderResults.java b/src_shortcuts_overrides/com/android/launcher3/model/LoaderResults.java
new file mode 100644
index 000000000..9785887ac
--- /dev/null
+++ b/src_shortcuts_overrides/com/android/launcher3/model/LoaderResults.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher3.model;
+
+import com.android.launcher3.AllAppsList;
+import com.android.launcher3.LauncherAppState;
+import com.android.launcher3.LauncherModel.Callbacks;
+import com.android.launcher3.util.ComponentKey;
+import com.android.launcher3.widget.WidgetListRowEntry;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+/**
+ * Helper class to handle results of {@link com.android.launcher3.model.LoaderTask}.
+ */
+public class LoaderResults extends BaseLoaderResults {
+
+ public LoaderResults(LauncherAppState app, BgDataModel dataModel,
+ AllAppsList allAppsList, int pageToBindFirst, WeakReference<Callbacks> callbacks) {
+ super(app, dataModel, allAppsList, pageToBindFirst, callbacks);
+ }
+
+ @Override
+ public void bindDeepShortcuts() {
+ final HashMap<ComponentKey, Integer> shortcutMapCopy;
+ synchronized (mBgDataModel) {
+ shortcutMapCopy = new HashMap<>(mBgDataModel.deepShortcutMap);
+ }
+ mUiExecutor.execute(() -> {
+ Callbacks callbacks = mCallbacks.get();
+ if (callbacks != null) {
+ callbacks.bindDeepShortcutMap(shortcutMapCopy);
+ }
+ });
+ }
+
+ @Override
+ public void bindWidgets() {
+ final ArrayList<WidgetListRowEntry> widgets =
+ mBgDataModel.widgetsModel.getWidgetsList(mApp.getContext());
+ Runnable r = new Runnable() {
+ public void run() {
+ Callbacks callbacks = mCallbacks.get();
+ if (callbacks != null) {
+ callbacks.bindAllWidgets(widgets);
+ }
+ }
+ };
+ mUiExecutor.execute(r);
+ }
+}