summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/LauncherModel.java
diff options
context:
space:
mode:
authorMario Bertschler <bmario@google.com>2017-03-15 11:56:47 -0700
committerMario Bertschler <bmario@google.com>2017-03-17 09:21:35 -0700
commit817afa34472dba49b1dee0489da11f410ff09fcd (patch)
tree5fae380bbe02dc661eb1e071f87d9426c14e7da3 /src/com/android/launcher3/LauncherModel.java
parent04030d5a449cb251fb8db2f74d054c4f3a4a608b (diff)
downloadandroid_packages_apps_Trebuchet-817afa34472dba49b1dee0489da11f410ff09fcd.tar.gz
android_packages_apps_Trebuchet-817afa34472dba49b1dee0489da11f410ff09fcd.tar.bz2
android_packages_apps_Trebuchet-817afa34472dba49b1dee0489da11f410ff09fcd.zip
Show promise app icon in All Apps while installation process.
This CL only modifies the model and is behind a feature flag which per default is set to false. The app icon will appear as a promise icon, it reacts on icon or label changes and the icon will be remove on finishing the installation process. With this CL the progress of the installation process is not visible. Bug: 23952570 Change-Id: I510825d0b0b1b01eb14f7e50f0a2358b0d8b99b5
Diffstat (limited to 'src/com/android/launcher3/LauncherModel.java')
-rw-r--r--src/com/android/launcher3/LauncherModel.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 35811d38a..707ec8642 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -25,7 +25,9 @@ import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.pm.ApplicationInfo;
import android.content.pm.LauncherActivityInfo;
+import android.content.pm.PackageInstaller;
import android.net.Uri;
import android.os.Handler;
import android.os.HandlerThread;
@@ -573,6 +575,25 @@ public class LauncherModel extends BroadcastReceiver
screensUri, null, null, null, LauncherSettings.WorkspaceScreens.SCREEN_RANK));
}
+ public void onInstallSessionCreated(final PackageInstallInfo sessionInfo) {
+ enqueueModelUpdateTask(new ExtendedModelTask() {
+ @Override
+ public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) {
+ apps.addPromiseApp(app.getContext(), sessionInfo);
+ if (!apps.added.isEmpty()) {
+ final ArrayList<AppInfo> arrayList = new ArrayList<>(apps.added);
+ apps.added.clear();
+ scheduleCallbackTask(new CallbackTask() {
+ @Override
+ public void execute(Callbacks callbacks) {
+ callbacks.bindAppsAdded(null, null, null, arrayList);
+ }
+ });
+ }
+ }
+ });
+ }
+
/**
* Runnable for the thread that loads the contents of the launcher:
* - workspace icons
@@ -1691,10 +1712,21 @@ public class LauncherModel extends BroadcastReceiver
});
}
}
+
+ if (FeatureFlags.LAUNCHER3_PROMISE_APPS_IN_ALL_APPS) {
+ // get all active sessions and add them to the all apps list
+ PackageInstallerCompat installer = PackageInstallerCompat.getInstance(mContext);
+ for (PackageInstaller.SessionInfo info : installer.getAllVerifiedSessions()) {
+ mBgAllAppsList.addPromiseApp(mContext,
+ PackageInstallInfo.fromInstallingState(info));
+ }
+ }
+
// Huh? Shouldn't this be inside the Runnable below?
final ArrayList<AppInfo> added = mBgAllAppsList.added;
mBgAllAppsList.added = new ArrayList<AppInfo>();
+
// Post callback on main thread
mUiExecutor.execute(new Runnable() {
public void run() {