From 83d6f38f4228197fbe60c725c101d4e9fde36466 Mon Sep 17 00:00:00 2001 From: Flavio Fiszman Date: Thu, 8 Oct 2020 12:49:11 +0100 Subject: [PATCH] Enable People Space launch icon based on flag. Change-Id: I96cdca776feafa738f96b8bffa61c780e68067da Test: Boot device with both flag values and check if icon is present. Bug: 169783793 --- .../res/values/required_apps_managed_device.xml | 1 + .../values/required_apps_managed_profile.xml | 1 + .../res/values/required_apps_managed_user.xml | 1 + packages/SystemUI/AndroidManifest.xml | 13 ++++++++++--- .../android/systemui/SystemUIApplication.java | 17 +++++++++++++++++ 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/core/res/res/values/required_apps_managed_device.xml b/core/res/res/values/required_apps_managed_device.xml index 40db9dfbcd2c6..e17d2147c8f0d 100644 --- a/core/res/res/values/required_apps_managed_device.xml +++ b/core/res/res/values/required_apps_managed_device.xml @@ -21,6 +21,7 @@ Takes precedence over the disallowed apps lists. --> com.android.settings + com.android.systemui com.android.contacts com.android.dialer com.android.stk diff --git a/core/res/res/values/required_apps_managed_profile.xml b/core/res/res/values/required_apps_managed_profile.xml index c6b37e810f1ac..6ed385ad50dfc 100644 --- a/core/res/res/values/required_apps_managed_profile.xml +++ b/core/res/res/values/required_apps_managed_profile.xml @@ -22,6 +22,7 @@ com.android.contacts com.android.settings + com.android.systemui com.android.providers.downloads com.android.providers.downloads.ui com.android.documentsui diff --git a/core/res/res/values/required_apps_managed_user.xml b/core/res/res/values/required_apps_managed_user.xml index 8800e53537764..a6fc573a1ebc5 100644 --- a/core/res/res/values/required_apps_managed_user.xml +++ b/core/res/res/values/required_apps_managed_user.xml @@ -21,6 +21,7 @@ Takes precedence over the disallowed apps lists. --> com.android.settings + com.android.systemui com.android.contacts com.android.dialer com.android.stk diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index bf9b809e56841..ef8064fe2c6a7 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -573,10 +573,17 @@ - + android:enabled="false" + android:theme="@android:style/Theme.Material.NoActionBar" + android:launchMode="singleInstance"> + + + + diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java index 7dcec3d75367d..b388a6eb5edd8 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java @@ -19,15 +19,18 @@ package com.android.systemui; import android.app.ActivityThread; import android.app.Application; import android.content.BroadcastReceiver; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; import android.content.res.Configuration; import android.os.Process; import android.os.SystemProperties; import android.os.Trace; import android.os.UserHandle; +import android.provider.Settings; import android.util.Log; import android.util.TimingsTraceLog; @@ -35,6 +38,7 @@ import com.android.systemui.dagger.ContextComponentHelper; import com.android.systemui.dagger.GlobalRootComponent; import com.android.systemui.dagger.SysUIComponent; import com.android.systemui.dump.DumpManager; +import com.android.systemui.people.PeopleSpaceActivity; import com.android.systemui.util.NotificationChannels; import java.lang.reflect.Constructor; @@ -104,6 +108,19 @@ public class SystemUIApplication extends Application implements mServices[i].onBootCompleted(); } } + // If flag SHOW_PEOPLE_SPACE is true, enable People Space launcher icon. + try { + int showPeopleSpace = Settings.Global.getInt(context.getContentResolver(), + Settings.Global.SHOW_PEOPLE_SPACE); + context.getPackageManager().setComponentEnabledSetting( + new ComponentName(context, PeopleSpaceActivity.class), + showPeopleSpace == 1 + ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED + : PackageManager.COMPONENT_ENABLED_STATE_DISABLED, + PackageManager.DONT_KILL_APP); + } catch (Exception e) { + Log.w(TAG, "Error enabling People Space launch icon:", e); + } } }, bootCompletedFilter);