am 69dffdb8: Disabling the focused hotseat app cling if GEL is not preinstalled on the device. (Bug. 13551957)
* commit '69dffdb83a614a6b02a2363e0ade510948549972':
Disabling the focused hotseat app cling if GEL is not preinstalled on the device. (Bug. 13551957)
diff --git a/src/com/android/launcher3/LauncherClings.java b/src/com/android/launcher3/LauncherClings.java
index 952edfd..97138ee 100644
--- a/src/com/android/launcher3/LauncherClings.java
+++ b/src/com/android/launcher3/LauncherClings.java
@@ -21,8 +21,11 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.app.ActivityManager;
+import android.content.ComponentName;
import android.content.Context;
import android.content.SharedPreferences;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.UserManager;
@@ -262,12 +265,21 @@
Cling c = initCling(R.id.workspace_cling, 0, false, true);
c.updateWorkspaceBubblePosition();
- // Set the focused hotseat app if there is one
- c.setFocusedHotseatApp(mLauncher.getFirstRunFocusedHotseatAppDrawableId(),
- mLauncher.getFirstRunFocusedHotseatAppRank(),
- mLauncher.getFirstRunFocusedHotseatAppComponentName(),
- mLauncher.getFirstRunFocusedHotseatAppBubbleTitle(),
- mLauncher.getFirstRunFocusedHotseatAppBubbleDescription());
+ try {
+ // We only enable the focused hotseat app if we are preinstalled
+ PackageManager pm = mLauncher.getPackageManager();
+ ApplicationInfo ai = pm.getApplicationInfo(mLauncher.getPackageName(), 0);
+ if ((ai.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
+ // Set the focused hotseat app
+ c.setFocusedHotseatApp(mLauncher.getFirstRunFocusedHotseatAppDrawableId(),
+ mLauncher.getFirstRunFocusedHotseatAppRank(),
+ mLauncher.getFirstRunFocusedHotseatAppComponentName(),
+ mLauncher.getFirstRunFocusedHotseatAppBubbleTitle(),
+ mLauncher.getFirstRunFocusedHotseatAppBubbleDescription());
+ }
+ } catch (PackageManager.NameNotFoundException e) {
+ e.printStackTrace();
+ }
} else {
removeCling(R.id.workspace_cling);
}