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

Commit 38f426c8 authored by Vladislav Kaznacheev's avatar Vladislav Kaznacheev
Browse files

Show the app shelf depending on the platform feature

This CL uses PackageManager.
FEATURE_FREEFORM_WINDOW_MANAGEMENT to determine
whether app shelf should be displayed, and removes
config_enableAppShelf flag that was previously used for that.

Bug: 25329519
Change-Id: I6460eca8e158b0e114e8f2cfdfea4a2e5eadd03b
parent 5dd803c9
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -269,9 +269,6 @@
    <!-- Duration of the expansion animation in the volume dialog -->
    <item name="volume_expand_animation_duration" type="integer">300</item>

    <!-- Whether to show a "shelf" of apps at the bottom of the screen. -->
    <bool name="config_enableAppShelf">false</bool>

    <!-- Whether to show the full screen user switcher. -->
    <bool name="config_enableFullscreenUserSwitcher">false</bool>

+15 −4
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.ContentObserver;
@@ -246,15 +247,25 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
     * Prudently disable QS and notifications.  */
    private static final boolean ONLY_CORE_APPS;

    /* If true, the device supports freeform window management.
     * This affects the status bar UI. */
    private static final boolean FREEFORM_WINDOW_MANAGEMENT;

    static {
        boolean onlyCoreApps;
        boolean freeformWindowManagement;
        try {
            onlyCoreApps = IPackageManager.Stub.asInterface(ServiceManager.getService("package"))
                    .isOnlyCoreApps();
            IPackageManager packageManager =
                    IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
            onlyCoreApps = packageManager.isOnlyCoreApps();
            freeformWindowManagement = packageManager.hasSystemFeature(
                    PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT);
        } catch (RemoteException e) {
            onlyCoreApps = false;
            freeformWindowManagement = false;
        }
        ONLY_CORE_APPS = onlyCoreApps;
        FREEFORM_WINDOW_MANAGEMENT = freeformWindowManagement;
    }

    PhoneStatusBarPolicy mIconPolicy;
@@ -982,8 +993,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        if (shelfOverride != DEFAULT) {
            return shelfOverride != 0;
        }
        // Otherwise default to the build setting.
        return mContext.getResources().getBoolean(R.bool.config_enableAppShelf);
        // Otherwise default to the platform feature.
        return FREEFORM_WINDOW_MANAGEMENT;
    }

    private void clearAllNotifications() {