summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Launcher.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2014-01-15 10:33:02 -0800
committerDanesh M <daneshm90@gmail.com>2014-06-06 22:54:26 -0700
commit69e918a4b2fa5cbc65bbd54643b5a6e94feaf8dc (patch)
tree55c3c127a8d5ce6ce9557f45e63054d9de351072 /src/com/android/launcher3/Launcher.java
parent83785b25cb2ac04cb2904564d7e3ca3b834ff6e7 (diff)
downloadandroid_packages_apps_Trebuchet-69e918a4b2fa5cbc65bbd54643b5a6e94feaf8dc.tar.gz
android_packages_apps_Trebuchet-69e918a4b2fa5cbc65bbd54643b5a6e94feaf8dc.tar.bz2
android_packages_apps_Trebuchet-69e918a4b2fa5cbc65bbd54643b5a6e94feaf8dc.zip
Tightening migration conditions. (Bug 11973614)
Change-Id: I6d7417b705227472d035f428cbec933cc6dbf2ce
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r--src/com/android/launcher3/Launcher.java29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 0dad0f4f8..bc04ab58a 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -45,6 +45,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
@@ -497,11 +498,18 @@ public class Launcher extends Activity
// On large interfaces, we want the screen to auto-rotate based on the current orientation
unlockScreenOrientation(true);
+ // The two first run cling paths are mutually exclusive, if the launcher is preinstalled
+ // on the device, then we always show the first run cling experience (or if there is no
+ // launcher2). Otherwise, we prompt the user upon started for migration
showFirstRunActivity();
- if (mModel.canMigrateFromOldLauncherDb()) {
- mLauncherClings.showMigrationCling();
+ if (mLauncherClings.shouldShowFirstRunOrMigrationClings()) {
+ if (mModel.canMigrateFromOldLauncherDb(this)) {
+ mLauncherClings.showMigrationCling();
+ } else {
+ mLauncherClings.showFirstRunCling();
+ }
} else {
- mLauncherClings.showFirstRunCling();
+ mLauncherClings.removeFirstRunAndMigrationClings();
}
}
@@ -4441,6 +4449,21 @@ public class Launcher extends Activity
mLauncherClings.updateSearchBarHint(hint);
}
+ protected boolean isLauncherPreinstalled() {
+ PackageManager pm = getPackageManager();
+ try {
+ ApplicationInfo ai = pm.getApplicationInfo(getComponentName().getPackageName(), 0);
+ if ((ai.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (NameNotFoundException e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+
protected String getFirstRunClingSearchBarHint() {
return "";
}