Loading packages/SystemUI/README.md +4 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,10 @@ Biometric UI. Delegates SysUI events to WM Shell controllers. ### [com.android.systemui.people.widget.PeopleSpaceWidgetEnabler](/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetEnabler.java) Enables People Space widgets. --- * [Plugins](/packages/SystemUI/docs/plugins.md) Loading packages/SystemUI/res/values/config.xml +1 −0 Original line number Diff line number Diff line Loading @@ -312,6 +312,7 @@ <item>com.android.systemui.accessibility.SystemActions</item> <item>com.android.systemui.toast.ToastUI</item> <item>com.android.systemui.wmshell.WMShell</item> <item>com.android.systemui.people.widget.PeopleSpaceWidgetEnabler</item> </string-array> <!-- QS tile shape store width. negative implies fill configuration instead of stroke--> Loading packages/SystemUI/src/com/android/systemui/SystemUIApplication.java +0 −19 Original line number Diff line number Diff line Loading @@ -19,18 +19,15 @@ 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; import android.view.SurfaceControl; Loading @@ -40,7 +37,6 @@ 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.widget.PeopleSpaceWidgetProvider; import com.android.systemui.shared.system.ThreadedRendererCompat; import com.android.systemui.util.NotificationChannels; Loading Loading @@ -125,21 +121,6 @@ public class SystemUIApplication extends Application implements mServices[i].onBootCompleted(); } } // If SHOW_PEOPLE_SPACE is true, enable People Space widget provider. // TODO(b/170396074): Migrate to new feature flag (go/silk-flags-howto) try { int showPeopleSpace = Settings.Global.getInt(context.getContentResolver(), Settings.Global.SHOW_PEOPLE_SPACE, 1); context.getPackageManager().setComponentEnabledSetting( new ComponentName(context, PeopleSpaceWidgetProvider.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 widget:", e); } } }, bootCompletedFilter); Loading packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java +7 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import com.android.systemui.globalactions.GlobalActionsComponent; import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.keyguard.dagger.KeyguardModule; import com.android.systemui.media.systemsounds.HomeSoundEffectController; import com.android.systemui.people.widget.PeopleSpaceWidgetEnabler; import com.android.systemui.power.PowerUI; import com.android.systemui.recents.Recents; import com.android.systemui.recents.RecentsModule; Loading Loading @@ -177,4 +178,10 @@ public abstract class SystemUIBinder { @IntoMap @ClassKey(HomeSoundEffectController.class) public abstract SystemUI bindHomeSoundEffectController(HomeSoundEffectController sysui); /** Inject into PeopleSpaceWidgetEnabler. */ @Binds @IntoMap @ClassKey(PeopleSpaceWidgetEnabler.class) public abstract SystemUI bindPeopleSpaceWidgetEnabler(PeopleSpaceWidgetEnabler sysui); } packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetEnabler.java 0 → 100644 +61 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.people.widget; import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageManager; import android.util.Log; import com.android.systemui.SystemUI; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.statusbar.FeatureFlags; import javax.inject.Inject; /** * Enables People Space widgets. */ @SysUISingleton public class PeopleSpaceWidgetEnabler extends SystemUI { private static final String TAG = "PeopleSpaceWdgtEnabler"; private Context mContext; private FeatureFlags mFeatureFlags; @Inject public PeopleSpaceWidgetEnabler(Context context, FeatureFlags featureFlags) { super(context); mContext = context; mFeatureFlags = featureFlags; } @Override public void start() { Log.d(TAG, "Starting service"); try { boolean showPeopleSpace = mFeatureFlags.isPeopleTileEnabled(); mContext.getPackageManager().setComponentEnabledSetting( new ComponentName(mContext, PeopleSpaceWidgetProvider.class), showPeopleSpace ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } catch (Exception e) { Log.w(TAG, "Error enabling People Space widget:", e); } } } Loading
packages/SystemUI/README.md +4 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,10 @@ Biometric UI. Delegates SysUI events to WM Shell controllers. ### [com.android.systemui.people.widget.PeopleSpaceWidgetEnabler](/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetEnabler.java) Enables People Space widgets. --- * [Plugins](/packages/SystemUI/docs/plugins.md) Loading
packages/SystemUI/res/values/config.xml +1 −0 Original line number Diff line number Diff line Loading @@ -312,6 +312,7 @@ <item>com.android.systemui.accessibility.SystemActions</item> <item>com.android.systemui.toast.ToastUI</item> <item>com.android.systemui.wmshell.WMShell</item> <item>com.android.systemui.people.widget.PeopleSpaceWidgetEnabler</item> </string-array> <!-- QS tile shape store width. negative implies fill configuration instead of stroke--> Loading
packages/SystemUI/src/com/android/systemui/SystemUIApplication.java +0 −19 Original line number Diff line number Diff line Loading @@ -19,18 +19,15 @@ 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; import android.view.SurfaceControl; Loading @@ -40,7 +37,6 @@ 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.widget.PeopleSpaceWidgetProvider; import com.android.systemui.shared.system.ThreadedRendererCompat; import com.android.systemui.util.NotificationChannels; Loading Loading @@ -125,21 +121,6 @@ public class SystemUIApplication extends Application implements mServices[i].onBootCompleted(); } } // If SHOW_PEOPLE_SPACE is true, enable People Space widget provider. // TODO(b/170396074): Migrate to new feature flag (go/silk-flags-howto) try { int showPeopleSpace = Settings.Global.getInt(context.getContentResolver(), Settings.Global.SHOW_PEOPLE_SPACE, 1); context.getPackageManager().setComponentEnabledSetting( new ComponentName(context, PeopleSpaceWidgetProvider.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 widget:", e); } } }, bootCompletedFilter); Loading
packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java +7 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import com.android.systemui.globalactions.GlobalActionsComponent; import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.keyguard.dagger.KeyguardModule; import com.android.systemui.media.systemsounds.HomeSoundEffectController; import com.android.systemui.people.widget.PeopleSpaceWidgetEnabler; import com.android.systemui.power.PowerUI; import com.android.systemui.recents.Recents; import com.android.systemui.recents.RecentsModule; Loading Loading @@ -177,4 +178,10 @@ public abstract class SystemUIBinder { @IntoMap @ClassKey(HomeSoundEffectController.class) public abstract SystemUI bindHomeSoundEffectController(HomeSoundEffectController sysui); /** Inject into PeopleSpaceWidgetEnabler. */ @Binds @IntoMap @ClassKey(PeopleSpaceWidgetEnabler.class) public abstract SystemUI bindPeopleSpaceWidgetEnabler(PeopleSpaceWidgetEnabler sysui); }
packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetEnabler.java 0 → 100644 +61 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.people.widget; import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageManager; import android.util.Log; import com.android.systemui.SystemUI; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.statusbar.FeatureFlags; import javax.inject.Inject; /** * Enables People Space widgets. */ @SysUISingleton public class PeopleSpaceWidgetEnabler extends SystemUI { private static final String TAG = "PeopleSpaceWdgtEnabler"; private Context mContext; private FeatureFlags mFeatureFlags; @Inject public PeopleSpaceWidgetEnabler(Context context, FeatureFlags featureFlags) { super(context); mContext = context; mFeatureFlags = featureFlags; } @Override public void start() { Log.d(TAG, "Starting service"); try { boolean showPeopleSpace = mFeatureFlags.isPeopleTileEnabled(); mContext.getPackageManager().setComponentEnabledSetting( new ComponentName(mContext, PeopleSpaceWidgetProvider.class), showPeopleSpace ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } catch (Exception e) { Log.w(TAG, "Error enabling People Space widget:", e); } } }