diff --git a/res/drawable/ic_install_no_shadow.xml b/res/drawable/ic_install_no_shadow.xml
new file mode 100644
index 0000000000..ffce22aac1
--- /dev/null
+++ b/res/drawable/ic_install_no_shadow.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1197b1cf2c..e9b00f6faf 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -90,6 +90,8 @@
Uninstall
App info
+
+ Install
diff --git a/src/com/android/launcher3/popup/PopupDataProvider.java b/src/com/android/launcher3/popup/PopupDataProvider.java
index de9f25e12f..c921b4b827 100644
--- a/src/com/android/launcher3/popup/PopupDataProvider.java
+++ b/src/com/android/launcher3/popup/PopupDataProvider.java
@@ -53,6 +53,7 @@ public class PopupDataProvider implements NotificationListener.NotificationsChan
private static final SystemShortcut[] SYSTEM_SHORTCUTS = new SystemShortcut[] {
new SystemShortcut.AppInfo(),
new SystemShortcut.Widgets(),
+ new SystemShortcut.Install()
};
private final Launcher mLauncher;
diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java
index 6254d2d008..a342500760 100644
--- a/src/com/android/launcher3/popup/SystemShortcut.java
+++ b/src/com/android/launcher3/popup/SystemShortcut.java
@@ -1,6 +1,7 @@
package com.android.launcher3.popup;
import android.content.Context;
+import android.content.Intent;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@@ -11,7 +12,10 @@ import com.android.launcher3.InfoDropTarget;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
+import com.android.launcher3.ShortcutInfo;
import com.android.launcher3.model.WidgetItem;
+import com.android.launcher3.util.InstantAppResolver;
+import com.android.launcher3.util.PackageManagerHelper;
import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.widget.WidgetsBottomSheet;
@@ -95,4 +99,35 @@ public abstract class SystemShortcut extends ItemInfo {
};
}
}
+
+ public static class Install extends SystemShortcut {
+ public Install() {
+ super(R.drawable.ic_install_no_shadow, R.string.install_drop_target_label);
+ }
+
+ @Override
+ public View.OnClickListener getOnClickListener(final Launcher launcher,
+ final ItemInfo itemInfo) {
+ boolean supportsWebUI = (itemInfo instanceof ShortcutInfo) &&
+ ((ShortcutInfo) itemInfo).hasStatusFlag(ShortcutInfo.FLAG_SUPPORTS_WEB_UI);
+ boolean isInstantApp = false;
+ if (itemInfo instanceof com.android.launcher3.AppInfo) {
+ com.android.launcher3.AppInfo appInfo = (com.android.launcher3.AppInfo) itemInfo;
+ isInstantApp = InstantAppResolver.newInstance(launcher).isInstantApp(appInfo);
+ }
+ boolean enabled = supportsWebUI || isInstantApp;
+ if (!enabled) {
+ return null;
+ }
+ return new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Intent intent = PackageManagerHelper.getMarketIntent(itemInfo
+ .getTargetComponent().getPackageName());
+ launcher.startActivitySafely(view, intent, itemInfo);
+ AbstractFloatingView.closeAllOpenViews(launcher);
+ }
+ };
+ }
+ }
}
diff --git a/src/com/android/launcher3/util/InstantAppResolver.java b/src/com/android/launcher3/util/InstantAppResolver.java
index e60d76808a..99ce7ca90f 100644
--- a/src/com/android/launcher3/util/InstantAppResolver.java
+++ b/src/com/android/launcher3/util/InstantAppResolver.java
@@ -19,6 +19,7 @@ package com.android.launcher3.util;
import android.content.Context;
import android.content.pm.ApplicationInfo;
+import com.android.launcher3.AppInfo;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
@@ -39,6 +40,10 @@ public class InstantAppResolver {
return false;
}
+ public boolean isInstantApp(AppInfo info) {
+ return false;
+ }
+
public List getInstantApps() {
return Collections.emptyList();
}