summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/compat/PackageInstallerCompat.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/compat/PackageInstallerCompat.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/compat/PackageInstallerCompat.java')
-rw-r--r--src/com/android/launcher3/compat/PackageInstallerCompat.java31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/com/android/launcher3/compat/PackageInstallerCompat.java b/src/com/android/launcher3/compat/PackageInstallerCompat.java
index c7fe0cec8..112cca540 100644
--- a/src/com/android/launcher3/compat/PackageInstallerCompat.java
+++ b/src/com/android/launcher3/compat/PackageInstallerCompat.java
@@ -16,9 +16,13 @@
package com.android.launcher3.compat;
+import android.content.ComponentName;
import android.content.Context;
+import android.content.pm.PackageInstaller;
+import android.support.annotation.NonNull;
import java.util.HashMap;
+import java.util.List;
public abstract class PackageInstallerCompat {
@@ -46,19 +50,34 @@ public abstract class PackageInstallerCompat {
public abstract void onStop();
public static final class PackageInstallInfo {
+ public final ComponentName componentName;
public final String packageName;
+ public final int state;
+ public final int progress;
- public int state;
- public int progress;
-
- public PackageInstallInfo(String packageName) {
- this.packageName = packageName;
+ private PackageInstallInfo(@NonNull PackageInstaller.SessionInfo info) {
+ this.state = STATUS_INSTALLING;
+ this.packageName = info.getAppPackageName();
+ this.componentName = new ComponentName(packageName, "");
+ this.progress = (int) (info.getProgress() * 100f);
}
public PackageInstallInfo(String packageName, int state, int progress) {
- this.packageName = packageName;
this.state = state;
+ this.packageName = packageName;
+ this.componentName = new ComponentName(packageName, "");
this.progress = progress;
}
+
+ public static PackageInstallInfo fromInstallingState(PackageInstaller.SessionInfo info) {
+ return new PackageInstallInfo(info);
+ }
+
+ public static PackageInstallInfo fromState(int state, String packageName) {
+ return new PackageInstallInfo(packageName, state, 0 /* progress */);
+ }
+
}
+
+ public abstract List<PackageInstaller.SessionInfo> getAllVerifiedSessions();
}