Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69dffdb8 authored by Winson Chung's avatar Winson Chung
Browse files

Disabling the focused hotseat app cling if GEL is not preinstalled on the device. (Bug. 13551957)

Change-Id: I24b25a0eada1ac9273a57b02d80a2451d08b02b0
parent eaabe7c8
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -21,8 +21,11 @@ import android.accounts.AccountManager;
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 @@ class LauncherClings {
            Cling c = initCling(R.id.workspace_cling, 0, false, true);
            c.updateWorkspaceBubblePosition();

            // Set the focused hotseat app if there is one
            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);
        }