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
This commit is contained in:
Vladislav Kaznacheev
2015-10-28 15:48:12 -07:00
parent 5dd803c938
commit 38f426c808
2 changed files with 15 additions and 7 deletions

View File

@@ -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>

View File

@@ -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() {