From 7ceb4966d47ba58d61bec4e583f02f822daaca80 Mon Sep 17 00:00:00 2001 From: Ed Heyl Date: Wed, 16 Oct 2013 07:51:38 -0700 Subject: [PATCH 1/9] override Launcher2 (aosp) Change-Id: Id4c9eb83048731ded2677f1d67c797065fc5b282 --- Android.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Android.mk b/Android.mk index 3b1a244bbf..3bd20a7cd1 100644 --- a/Android.mk +++ b/Android.mk @@ -37,7 +37,7 @@ LOCAL_SDK_VERSION := 19 LOCAL_PACKAGE_NAME := Launcher3 #LOCAL_CERTIFICATE := shared -LOCAL_OVERRIDES_PACKAGES := Home +LOCAL_OVERRIDES_PACKAGES := Launcher2 LOCAL_PROGUARD_FLAG_FILES := proguard.flags From cdd1b6f5590953bcf845353f1823e68a253f0bba Mon Sep 17 00:00:00 2001 From: Baligh Uddin Date: Mon, 21 Oct 2013 11:45:08 -0700 Subject: [PATCH 2/9] Import translations. DO NOT MERGE Change-Id: I7d8df8c393285daf3f102589bc80e4d787bd046b Auto-generated-cl: translation import --- res/values-sw/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/values-sw/strings.xml b/res/values-sw/strings.xml index 606a80d3bf..d78b53671b 100644 --- a/res/values-sw/strings.xml +++ b/res/values-sw/strings.xml @@ -104,7 +104,7 @@ "Unda skrini zaidi za programu na folda" "Panga nafasi yako" - "Gusa na ushikile mandharinyuma ili udhibiti mandhari, wijeti, na mipangilio." + "Gusa na ushikilie mandharinyuma ili udhibiti mandhari, wijeti, na mipangilio." "Chagua programu kadhaa" "Ili kuongeza programu kwenye Skrini yako Kuu, iguse na uishikilie." "Folda hii hapa" From a8484d84554a8ac015fed5793322a6152c68945a Mon Sep 17 00:00:00 2001 From: Baligh Uddin Date: Wed, 30 Oct 2013 12:03:51 -0700 Subject: [PATCH 3/9] Import translations. DO NOT MERGE Change-Id: I586af82bace882d917c7bc3ecc241e690c44fc45 Auto-generated-cl: translation import --- res/values-ar/strings.xml | 20 ++++++++++---------- res/values-fa/strings.xml | 22 +++++++++++----------- res/values-iw/strings.xml | 22 +++++++++++----------- res/values-sw/strings.xml | 2 +- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/res/values-ar/strings.xml b/res/values-ar/strings.xml index 73ee690f99..4794772926 100644 --- a/res/values-ar/strings.xml +++ b/res/values-ar/strings.xml @@ -21,15 +21,15 @@ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> "Launcher3" "الرئيسية" - "تطبيقات Android الأساسية" + "‏تطبيقات Android الأساسية" "تعيين خلفية" - "تم تحديد %1$d" - "تم تحديد %1$d" - "تم تحديد %1$d" + "‏تم تحديد %1$d" + "‏تم تحديد %1$d" + "‏تم تحديد %1$d" - "الخلفية %1$d من %2$d" + "‏الخلفية %1$d من %2$d" "تم تحديد %1$s" "حذف" "اختيار صورة" @@ -91,11 +91,11 @@ "هذا تطبيق نظام وتتعذر إزالته." "قاذفة صواريخ" "مجلد بدون اسم" - "الشاشة الرئيسية %1$d" - "الصفحة %1$d من %2$d" - "الشاشة الرئيسية %1$d من %2$d" - "صفحة التطبيقات %1$d من %2$d" - "صفحة الأدوات %1$d من %2$d" + "‏الشاشة الرئيسية %1$d" + "‏الصفحة %1$d من %2$d" + "‏الشاشة الرئيسية %1$d من %2$d" + "‏صفحة التطبيقات %1$d من %2$d" + "‏صفحة الأدوات %1$d من %2$d" "مرحبًا!" "تصرف على راحتك." diff --git a/res/values-fa/strings.xml b/res/values-fa/strings.xml index 3a0d0b8753..657b5db486 100644 --- a/res/values-fa/strings.xml +++ b/res/values-fa/strings.xml @@ -21,15 +21,15 @@ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> "Launcher3" "صفحه اصلی" - "برنامه‌های Android Core" + "‏برنامه‌های Android Core" "تنظیم کاغذدیواری" - "%1$d انتخاب شد" - "%1$d انتخاب شد" - "%1$d انتخاب شد" + "‏%1$d انتخاب شد" + "‏%1$d انتخاب شد" + "‏%1$d انتخاب شد" - "کاغذ دیواری %1$d از %2$d" + "‏کاغذ دیواری %1$d از %2$d" "%1$s انتخاب شده" "حذف" "انتخاب تصویر" @@ -38,7 +38,7 @@ "برنامه نصب نشده است." "ابزارک‌ها" "ابزارک‌ها" - "نمایش Mem" + "‏نمایش Mem" "برای انتخاب ابزارک لمس کنید و نگه دارید." "فروشگاه" "%1$d × %2$d" @@ -91,11 +91,11 @@ "این برنامه سیستمی است و حذف نصب نمی‌شود." "Rocket Launcher" "پوشه بی‌نام" - "صفحه اصلی %1$d" - "صفحه %1$d از %2$d" - "صفحه اصلی %1$d از %2$d" - "صفحه برنامه‌ها %1$d از %2$d" - "صفحه ابزارک‌ها %1$d از %2$d" + "‏صفحه اصلی %1$d" + "‏صفحه %1$d از %2$d" + "‏صفحه اصلی %1$d از %2$d" + "‏صفحه برنامه‌ها %1$d از %2$d" + "‏صفحه ابزارک‌ها %1$d از %2$d" "خوش آمدید!" "راحت باشید." diff --git a/res/values-iw/strings.xml b/res/values-iw/strings.xml index 603dbb5006..562ce4f486 100644 --- a/res/values-iw/strings.xml +++ b/res/values-iw/strings.xml @@ -21,15 +21,15 @@ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> "Launcher3" "דף הבית" - "אפליקציות הליבה של Android" + "‏אפליקציות הליבה של Android" - "הגדר טפט" + "בחר טפט" - "%1$d נבחרו" - "%1$d נבחרו" - "%1$d נבחרו" + "‏%1$d נבחרו" + "‏%1$d נבחרו" + "‏%1$d נבחרו" - "טפט %1$d מתוך %2$d" + "‏טפט %1$d מתוך %2$d" "בחרת %1$s" "מחק" "בחר תמונה" @@ -91,11 +91,11 @@ "זוהי אפליקציית מערכת ולא ניתן להסיר את התקנתה." "Rocket Launcher" "תיקיה ללא שם" - "מסך דף הבית %1$d" - "דף %1$d מתוך %2$d" - "מסך דף הבית %1$d מתוך %2$d" - "דף אפליקציות %1$d מתוך %2$d" - "דף רכיבי ווידג\'ט ‏%1$d מתוך %2$d" + "‏מסך דף הבית %1$d" + "‏דף %1$d מתוך %2$d" + "‏מסך דף הבית %1$d מתוך %2$d" + "‏דף אפליקציות %1$d מתוך %2$d" + "‏דף רכיבי ווידג\'ט ‏%1$d מתוך %2$d" "ברוך הבא!" "להרגיש בבית." diff --git a/res/values-sw/strings.xml b/res/values-sw/strings.xml index d78b53671b..c610f34901 100644 --- a/res/values-sw/strings.xml +++ b/res/values-sw/strings.xml @@ -107,7 +107,7 @@ "Gusa na ushikilie mandharinyuma ili udhibiti mandhari, wijeti, na mipangilio." "Chagua programu kadhaa" "Ili kuongeza programu kwenye Skrini yako Kuu, iguse na uishikilie." - "Folda hii hapa" + "Hii ni folda" "Ili kuunda kama hii, gusa na ushikilie programu, kisha ipitishe juu ya nyingine." "SAWA" "Folda imefunguliwa, %1$d kwa %2$d" From 322554a0a54c6f9160181a46b37e7914373115a8 Mon Sep 17 00:00:00 2001 From: Baligh Uddin Date: Wed, 6 Nov 2013 15:18:13 -0800 Subject: [PATCH 4/9] Import translations. DO NOT MERGE Change-Id: Idbcab8e4b31f94c10c4c2275c651b058810c7f1b Auto-generated-cl: translation import --- res/values-de/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 7a5e7e6b7b..85e42cfcd4 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -100,7 +100,7 @@ "Gerät personalisieren" - "Weitere Bildschirme für Apps und Ordner erstellen" + "Mehr Bildschirme für Apps und Ordner erstellen" "Arbeitsbereich organisieren" "Hintergrund berühren und halten, um Hintergrund, Widgets und Einstellungen zu verwalten" "Apps auswählen" From 415c34b93ca572be42eeef2d4c2efba53c92a74e Mon Sep 17 00:00:00 2001 From: Baligh Uddin Date: Wed, 18 Dec 2013 23:07:25 -0800 Subject: [PATCH 5/9] Import translations. DO NOT MERGE Change-Id: I6d843f955e2058b71d0f83956a805370c24a5eef Auto-generated-cl: translation import --- res/values-de/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 85e42cfcd4..ee732aa3ce 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -96,7 +96,7 @@ "Startbildschirm %1$d von %2$d" "Apps-Seite %1$d von %2$d" "Widgets-Seite %1$d von %2$d" - "Willkommen!" + "Hallo!" "Gerät personalisieren" From d6c6745b2e071847e91b5de4a493c612457561c7 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 15 Jan 2014 10:33:02 -0800 Subject: [PATCH 6/9] Tightening migration conditions. (Bug 11973614) Change-Id: I6d7417b705227472d035f428cbec933cc6dbf2ce (cherry picked from commit e43a1e788223ab5a4405c5eeb0133ff57efbc768) --- src/com/android/launcher3/Launcher.java | 29 +++++++++-- src/com/android/launcher3/LauncherClings.java | 48 ++++++++++++------- src/com/android/launcher3/LauncherModel.java | 4 +- 3 files changed, 58 insertions(+), 23 deletions(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 765fca4993..09c15a7a94 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -41,6 +41,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; @@ -478,11 +479,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(); } } @@ -4262,6 +4270,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 ""; } diff --git a/src/com/android/launcher3/LauncherClings.java b/src/com/android/launcher3/LauncherClings.java index 541eaddd0d..45f068b876 100644 --- a/src/com/android/launcher3/LauncherClings.java +++ b/src/com/android/launcher3/LauncherClings.java @@ -200,14 +200,27 @@ class LauncherClings { } } - /** Shows the first run cling */ - public void showFirstRunCling() { + public boolean shouldShowFirstRunOrMigrationClings() { SharedPreferences sharedPrefs = mLauncher.getSharedPrefs(); - if (isClingsEnabled() && - !sharedPrefs.getBoolean(FIRST_RUN_CLING_DISMISSED_KEY, false) && - !skipCustomClingIfNoAccounts() ) { + return isClingsEnabled() && + !sharedPrefs.getBoolean(FIRST_RUN_CLING_DISMISSED_KEY, false) && + !sharedPrefs.getBoolean(MIGRATION_CLING_DISMISSED_KEY, false); + } + public void removeFirstRunAndMigrationClings() { + removeCling(R.id.first_run_cling); + removeCling(R.id.migration_cling); + } + /** + * Shows the first run cling. + * + * This flow is mutually exclusive with showMigrationCling, and only runs if this Launcher + * package was preinstalled or there is no db to migrate from. + */ + public void showFirstRunCling() { + if (!skipCustomClingIfNoAccounts()) { + SharedPreferences sharedPrefs = mLauncher.getSharedPrefs(); // If we're not using the default workspace layout, replace workspace cling // with a custom workspace cling (usually specified in an overlay) // For now, only do this on tablets @@ -238,22 +251,22 @@ class LauncherClings { } initCling(R.id.first_run_cling, 0, false, true); } else { - removeCling(R.id.first_run_cling); + removeFirstRunAndMigrationClings(); } } + /** + * Shows the migration cling. + * + * This flow is mutually exclusive with showFirstRunCling, and only runs if this Launcher + * package was not preinstalled and there exists a db to migrate from. + */ public void showMigrationCling() { - // Enable the clings only if they have not been dismissed before - if (isClingsEnabled() && !mLauncher.getSharedPrefs().getBoolean( - MIGRATION_CLING_DISMISSED_KEY, false)) { - mLauncher.hideWorkspaceSearchAndHotseat(); + mLauncher.hideWorkspaceSearchAndHotseat(); - Cling c = initCling(R.id.migration_cling, 0, false, true); - c.bringScrimToFront(); - c.bringToFront(); - } else { - removeCling(R.id.migration_cling); - } + Cling c = initCling(R.id.migration_cling, 0, false, true); + c.bringScrimToFront(); + c.bringToFront(); } public void showMigrationWorkspaceCling() { @@ -300,7 +313,6 @@ class LauncherClings { } } - /** Removes the cling outright from the DragLayer */ private void removeCling(int id) { final View cling = mLauncher.findViewById(id); @@ -441,4 +453,4 @@ class LauncherClings { dismissCling(cling, null, FOLDER_CLING_DISMISSED_KEY, DISMISS_CLING_DURATION, true); } -} \ No newline at end of file +} diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index d271976a79..4478e9bbd3 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -227,8 +227,8 @@ public class LauncherModel extends BroadcastReceiver { } } - boolean canMigrateFromOldLauncherDb() { - return mOldContentProviderExists; + boolean canMigrateFromOldLauncherDb(Launcher launcher) { + return mOldContentProviderExists && !launcher.isLauncherPreinstalled() ; } static boolean findNextAvailableIconSpaceInScreen(ArrayList items, int[] xy, From c3993d15d9a2d5a4643faa44ac10a12667429b5e Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Tue, 14 Jan 2014 10:30:27 -0800 Subject: [PATCH 7/9] Properly saving migration cling keys. Change-Id: Id52a12da6af0fc91463dae07bbeb355ee04873d0 (cherry picked from commit 285b6e1483fd7ddc941fb2c9c50d43ee1b1841ca) --- src/com/android/launcher3/LauncherClings.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/com/android/launcher3/LauncherClings.java b/src/com/android/launcher3/LauncherClings.java index 541eaddd0d..85937aa62e 100644 --- a/src/com/android/launcher3/LauncherClings.java +++ b/src/com/android/launcher3/LauncherClings.java @@ -373,14 +373,14 @@ class LauncherClings { showMigrationWorkspaceCling(); } }; - dismissCling(cling, cb, WORKSPACE_CLING_DISMISSED_KEY, + dismissCling(cling, cb, MIGRATION_CLING_DISMISSED_KEY, DISMISS_CLING_DURATION, true); } }; mLauncher.getWorkspace().post(dismissCb); } - private void dismissAnyWorkspaceCling(Cling cling, View v) { + private void dismissAnyWorkspaceCling(Cling cling, String key, View v) { Runnable cb = null; if (v == null) { cb = new Runnable() { @@ -389,8 +389,7 @@ class LauncherClings { } }; } - dismissCling(cling, cb, WORKSPACE_CLING_DISMISSED_KEY, - DISMISS_CLING_DURATION, true); + dismissCling(cling, cb, key, DISMISS_CLING_DURATION, true); // Fade in the search bar mLauncher.getSearchBar().showSearchBar(true); @@ -428,12 +427,12 @@ class LauncherClings { public void dismissMigrationWorkspaceCling(View v) { Cling cling = (Cling) mLauncher.findViewById(R.id.migration_workspace_cling); - dismissAnyWorkspaceCling(cling, v); + dismissAnyWorkspaceCling(cling, MIGRATION_WORKSPACE_CLING_DISMISSED_KEY, v); } public void dismissWorkspaceCling(View v) { Cling cling = (Cling) mLauncher.findViewById(R.id.workspace_cling); - dismissAnyWorkspaceCling(cling, v); + dismissAnyWorkspaceCling(cling, WORKSPACE_CLING_DISMISSED_KEY, v); } public void dismissFolderCling(View v) { From 930514df0529ff5316bb00f3e45a4de036b7f5aa Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Thu, 16 Jan 2014 16:07:50 -0800 Subject: [PATCH 8/9] Fix overlapping pages (issue 12551580) Change-Id: I03c29c36828b6c4baadb33b13b0e852b07b2d40f (cherry picked from commit efb31e399d335351a8db3de54ed66fabd30606ba) --- src/com/android/launcher3/DeviceProfile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 8bcf6c32e0..7ca4f811c2 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -557,7 +557,7 @@ public class DeviceProfile { // In portrait, we want the pages spaced such that there is no // overhang of the previous / next page into the current page viewport. // We assume symmetrical padding in portrait mode. - return 2 * getWorkspacePadding().left; + return Math.max(defaultPageSpacingPx, 2 * getWorkspacePadding().left); } } From beb7bc6028eeeea160b17df800b0a886eecd1c9b Mon Sep 17 00:00:00 2001 From: Baligh Uddin Date: Thu, 20 Feb 2014 09:42:49 -0800 Subject: [PATCH 9/9] Import translations. DO NOT MERGE Change-Id: I6fb7884fae6cc8e09ca5fe51f28f5f80b183e9b5 Auto-generated-cl: translation import --- res/values-lo-rLA/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/res/values-lo-rLA/strings.xml b/res/values-lo-rLA/strings.xml index 79a0a4a48c..5ced01ab02 100644 --- a/res/values-lo-rLA/strings.xml +++ b/res/values-lo-rLA/strings.xml @@ -52,9 +52,9 @@ "ແອັບຯ" "ໜ້າຫຼັກ" "ລຶບ" - "ຖອນການຕິດຕັ້ງ" + "ຖອນ​ການ​ຕິດ​ຕັ້ງ" "ລຶບ" - "ຖອນການຕິດຕັ້ງ" + "ຖອນ​ການ​ຕິດ​ຕັ້ງ" "ຂໍ້ມູນແອັບຯ" "ຊອກຫາ" "ຊອກຫາດ້ວຍສຽງ"