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)
This commit is contained in:
Winson Chung
2014-04-05 02:57:36 +00:00
committed by Android Git Automerger
+18 -6
View File
@@ -21,8 +21,11 @@ import android.accounts.AccountManager;
import android.animation.Animator; import android.animation.Animator;
import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorListenerAdapter;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.Rect; import android.graphics.Rect;
import android.os.Bundle; import android.os.Bundle;
import android.os.UserManager; import android.os.UserManager;
@@ -262,12 +265,21 @@ class LauncherClings {
Cling c = initCling(R.id.workspace_cling, 0, false, true); Cling c = initCling(R.id.workspace_cling, 0, false, true);
c.updateWorkspaceBubblePosition(); c.updateWorkspaceBubblePosition();
// Set the focused hotseat app if there is one try {
c.setFocusedHotseatApp(mLauncher.getFirstRunFocusedHotseatAppDrawableId(), // We only enable the focused hotseat app if we are preinstalled
mLauncher.getFirstRunFocusedHotseatAppRank(), PackageManager pm = mLauncher.getPackageManager();
mLauncher.getFirstRunFocusedHotseatAppComponentName(), ApplicationInfo ai = pm.getApplicationInfo(mLauncher.getPackageName(), 0);
mLauncher.getFirstRunFocusedHotseatAppBubbleTitle(), if ((ai.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
mLauncher.getFirstRunFocusedHotseatAppBubbleDescription()); // Set the focused hotseat app
c.setFocusedHotseatApp(mLauncher.getFirstRunFocusedHotseatAppDrawableId(),
mLauncher.getFirstRunFocusedHotseatAppRank(),
mLauncher.getFirstRunFocusedHotseatAppComponentName(),
mLauncher.getFirstRunFocusedHotseatAppBubbleTitle(),
mLauncher.getFirstRunFocusedHotseatAppBubbleDescription());
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
} else { } else {
removeCling(R.id.workspace_cling); removeCling(R.id.workspace_cling);
} }