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

Commit 63ed0170 authored by Flavio Fiszman's avatar Flavio Fiszman Committed by Automerger Merge Worker
Browse files

Merge "Stop checking FeatureFlags for People Tile." into sc-dev am: b8d3b7d2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13699728

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie594cb6acce39807214a4c3e928071f27e704a8b
parents f3f39581 b8d3b7d2
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -144,10 +144,6 @@ 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)
+0 −1
Original line number Diff line number Diff line
@@ -315,7 +315,6 @@
        <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-->
+25 −0
Original line number Diff line number Diff line
@@ -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;
import android.view.SurfaceControl;
@@ -37,6 +40,8 @@ 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.people.widget.PeopleSpaceWidgetProvider;
import com.android.systemui.shared.system.ThreadedRendererCompat;
import com.android.systemui.util.NotificationChannels;

@@ -121,6 +126,26 @@ 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);
                        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 widget:", e);
                    }
                }
            }, bootCompletedFilter);

+0 −7
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ 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.privacy.television.TvOngoingPrivacyChip;
import com.android.systemui.recents.Recents;
@@ -185,10 +184,4 @@ 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);
}
+0 −68
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.people.PeopleSpaceActivity;
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);
            mContext.getPackageManager().setComponentEnabledSetting(
                    new ComponentName(mContext, PeopleSpaceActivity.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