summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2012-05-22 23:42:52 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-05-22 23:42:52 -0700
commitf5fca8507fecbd476d61ed75c59b6aa53d57033b (patch)
treec3436e9b5779eea6790c19ef624261250549a8bc
parentf44a1a70325818195ae56178eb55b90ecbdd8b6f (diff)
parenta4fe21285b33301ffed4d91ff03886ec5d30481a (diff)
downloadandroid_packages_apps_Trebuchet-f5fca8507fecbd476d61ed75c59b6aa53d57033b.zip
android_packages_apps_Trebuchet-f5fca8507fecbd476d61ed75c59b6aa53d57033b.tar.gz
android_packages_apps_Trebuchet-f5fca8507fecbd476d61ed75c59b6aa53d57033b.tar.bz2
am a4fe2128: Merge "Skip custom Play cling if no accounts are set up" into jb-dev
* commit 'a4fe21285b33301ffed4d91ff03886ec5d30481a': Skip custom Play cling if no accounts are set up
-rw-r--r--AndroidManifest.xml1
-rw-r--r--src/com/android/launcher2/Cling.java4
-rw-r--r--src/com/android/launcher2/Launcher.java17
3 files changed, 21 insertions, 1 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index a0ebe6fb..20c4a9d 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -57,6 +57,7 @@
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.BIND_APPWIDGET" />
+ <uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.android.launcher.permission.WRITE_SETTINGS" />
diff --git a/src/com/android/launcher2/Cling.java b/src/com/android/launcher2/Cling.java
index 5cde0b4..c83ee2f 100644
--- a/src/com/android/launcher2/Cling.java
+++ b/src/com/android/launcher2/Cling.java
@@ -115,6 +115,10 @@ public class Cling extends FrameLayout {
mIsInitialized = false;
}
+ public String getDrawIdentifier() {
+ return mDrawIdentifier;
+ }
+
private int[] getPunchThroughPositions() {
if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT)) {
return new int[]{getMeasuredWidth() / 2, getMeasuredHeight() - (mButtonBarHeight / 2)};
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 84b5003..d01de9c 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -17,6 +17,8 @@
package com.android.launcher2;
+import android.accounts.Account;
+import android.accounts.AccountManager;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
@@ -3516,10 +3518,23 @@ public final class Launcher extends Activity
});
}
}
+
+ private boolean skipCustomClingIfNoAccounts() {
+ Cling cling = (Cling) findViewById(R.id.workspace_cling);
+ boolean customCling = cling.getDrawIdentifier().equals("workspace_custom");
+ if (customCling) {
+ AccountManager am = AccountManager.get(this);
+ Account[] accounts = am.getAccountsByType("com.google");
+ return accounts.length == 0;
+ }
+ return false;
+ }
+
public void showFirstRunWorkspaceCling() {
// Enable the clings only if they have not been dismissed before
if (isClingsEnabled() &&
- !mSharedPrefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false)) {
+ !mSharedPrefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false) &&
+ !skipCustomClingIfNoAccounts() ) {
initCling(R.id.workspace_cling, null, false, 0);
} else {
removeCling(R.id.workspace_cling);