Loading packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +2 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.android.systemui.statusbar.phone.KeyguardLiftController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.StatusBarComponent; import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.util.concurrency.ConcurrencyModule; import com.android.systemui.util.sensors.AsyncSensorManager; import com.android.systemui.util.time.SystemClock; import com.android.systemui.util.time.SystemClockImpl; Loading @@ -53,6 +54,7 @@ import dagger.Provides; * implementation. */ @Module(includes = {AssistModule.class, ConcurrencyModule.class, PeopleHubModule.class}, subcomponents = {StatusBarComponent.class}) public abstract class SystemUIModule { Loading packages/SystemUI/src/com/android/systemui/dagger/qualifiers/Background.java 0 → 100644 +30 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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.dagger.qualifiers; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import javax.inject.Qualifier; @Qualifier @Documented @Retention(RUNTIME) public @interface Background { } packages/SystemUI/src/com/android/systemui/dagger/qualifiers/Main.java 0 → 100644 +30 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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.dagger.qualifiers; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import javax.inject.Qualifier; @Qualifier @Documented @Retention(RUNTIME) public @interface Main { } packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java +11 −11 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Handler; import android.provider.Settings; import android.service.quicksettings.Tile; import android.service.quicksettings.TileService; Loading @@ -34,8 +33,8 @@ import android.util.ArraySet; import android.widget.Button; import com.android.systemui.R; import com.android.systemui.dagger.qualifiers.BgHandler; import com.android.systemui.dagger.qualifiers.MainHandler; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.plugins.qs.QSTile; import com.android.systemui.plugins.qs.QSTile.State; import com.android.systemui.qs.QSTileHost; Loading @@ -47,6 +46,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.concurrent.Executor; import javax.inject.Inject; Loading @@ -55,8 +55,8 @@ public class TileQueryHelper { private final ArrayList<TileInfo> mTiles = new ArrayList<>(); private final ArraySet<String> mSpecs = new ArraySet<>(); private final Handler mBgHandler; private final Handler mMainHandler; private final Executor mMainExecutor; private final Executor mBgExecutor; private final Context mContext; private TileStateListener mListener; Loading @@ -64,10 +64,10 @@ public class TileQueryHelper { @Inject public TileQueryHelper(Context context, @MainHandler Handler mainHandler, @BgHandler Handler bgHandler) { @Main Executor mainExecutor, @Background Executor bgExecutor) { mContext = context; mMainHandler = mainHandler; mBgHandler = bgHandler; mMainExecutor = mainExecutor; mBgExecutor = bgExecutor; } public void setListener(TileStateListener listener) { Loading Loading @@ -126,7 +126,7 @@ public class TileQueryHelper { tilesToAdd.add(tile); } mBgHandler.post(() -> { mBgExecutor.execute(() -> { for (QSTile tile : tilesToAdd) { final QSTile.State state = tile.getState().copy(); // Ignore the current state and get the generic label instead. Loading @@ -139,7 +139,7 @@ public class TileQueryHelper { } private void addPackageTiles(final QSTileHost host) { mBgHandler.post(() -> { mBgExecutor.execute(() -> { Collection<QSTile> params = host.getTiles(); PackageManager pm = mContext.getPackageManager(); List<ResolveInfo> services = pm.queryIntentServicesAsUser( Loading Loading @@ -185,7 +185,7 @@ public class TileQueryHelper { private void notifyTilesChanged(final boolean finished) { final ArrayList<TileInfo> tilesToReturn = new ArrayList<>(mTiles); mMainHandler.post(() -> { mMainExecutor.execute(() -> { if (mListener != null) { mListener.onTilesChanged(tilesToReturn); } Loading packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java +4 −5 Original line number Diff line number Diff line Loading @@ -17,14 +17,13 @@ package com.android.systemui.statusbar; import android.annotation.NonNull; import android.os.Handler; import android.os.HandlerExecutor; import android.provider.DeviceConfig; import android.util.ArrayMap; import com.android.systemui.dagger.qualifiers.BgHandler; import com.android.systemui.dagger.qualifiers.Background; import java.util.Map; import java.util.concurrent.Executor; import javax.inject.Inject; import javax.inject.Singleton; Loading @@ -49,10 +48,10 @@ public class FeatureFlags { private final Map<String, Boolean> mCachedDeviceConfigFlags = new ArrayMap<>(); @Inject public FeatureFlags(@BgHandler Handler bgHandler) { public FeatureFlags(@Background Executor executor) { DeviceConfig.addOnPropertiesChangedListener( "systemui", new HandlerExecutor(bgHandler), executor, this::onPropertiesChanged); } Loading Loading
packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +2 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.android.systemui.statusbar.phone.KeyguardLiftController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.StatusBarComponent; import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.util.concurrency.ConcurrencyModule; import com.android.systemui.util.sensors.AsyncSensorManager; import com.android.systemui.util.time.SystemClock; import com.android.systemui.util.time.SystemClockImpl; Loading @@ -53,6 +54,7 @@ import dagger.Provides; * implementation. */ @Module(includes = {AssistModule.class, ConcurrencyModule.class, PeopleHubModule.class}, subcomponents = {StatusBarComponent.class}) public abstract class SystemUIModule { Loading
packages/SystemUI/src/com/android/systemui/dagger/qualifiers/Background.java 0 → 100644 +30 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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.dagger.qualifiers; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import javax.inject.Qualifier; @Qualifier @Documented @Retention(RUNTIME) public @interface Background { }
packages/SystemUI/src/com/android/systemui/dagger/qualifiers/Main.java 0 → 100644 +30 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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.dagger.qualifiers; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import javax.inject.Qualifier; @Qualifier @Documented @Retention(RUNTIME) public @interface Main { }
packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java +11 −11 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Handler; import android.provider.Settings; import android.service.quicksettings.Tile; import android.service.quicksettings.TileService; Loading @@ -34,8 +33,8 @@ import android.util.ArraySet; import android.widget.Button; import com.android.systemui.R; import com.android.systemui.dagger.qualifiers.BgHandler; import com.android.systemui.dagger.qualifiers.MainHandler; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.plugins.qs.QSTile; import com.android.systemui.plugins.qs.QSTile.State; import com.android.systemui.qs.QSTileHost; Loading @@ -47,6 +46,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.concurrent.Executor; import javax.inject.Inject; Loading @@ -55,8 +55,8 @@ public class TileQueryHelper { private final ArrayList<TileInfo> mTiles = new ArrayList<>(); private final ArraySet<String> mSpecs = new ArraySet<>(); private final Handler mBgHandler; private final Handler mMainHandler; private final Executor mMainExecutor; private final Executor mBgExecutor; private final Context mContext; private TileStateListener mListener; Loading @@ -64,10 +64,10 @@ public class TileQueryHelper { @Inject public TileQueryHelper(Context context, @MainHandler Handler mainHandler, @BgHandler Handler bgHandler) { @Main Executor mainExecutor, @Background Executor bgExecutor) { mContext = context; mMainHandler = mainHandler; mBgHandler = bgHandler; mMainExecutor = mainExecutor; mBgExecutor = bgExecutor; } public void setListener(TileStateListener listener) { Loading Loading @@ -126,7 +126,7 @@ public class TileQueryHelper { tilesToAdd.add(tile); } mBgHandler.post(() -> { mBgExecutor.execute(() -> { for (QSTile tile : tilesToAdd) { final QSTile.State state = tile.getState().copy(); // Ignore the current state and get the generic label instead. Loading @@ -139,7 +139,7 @@ public class TileQueryHelper { } private void addPackageTiles(final QSTileHost host) { mBgHandler.post(() -> { mBgExecutor.execute(() -> { Collection<QSTile> params = host.getTiles(); PackageManager pm = mContext.getPackageManager(); List<ResolveInfo> services = pm.queryIntentServicesAsUser( Loading Loading @@ -185,7 +185,7 @@ public class TileQueryHelper { private void notifyTilesChanged(final boolean finished) { final ArrayList<TileInfo> tilesToReturn = new ArrayList<>(mTiles); mMainHandler.post(() -> { mMainExecutor.execute(() -> { if (mListener != null) { mListener.onTilesChanged(tilesToReturn); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java +4 −5 Original line number Diff line number Diff line Loading @@ -17,14 +17,13 @@ package com.android.systemui.statusbar; import android.annotation.NonNull; import android.os.Handler; import android.os.HandlerExecutor; import android.provider.DeviceConfig; import android.util.ArrayMap; import com.android.systemui.dagger.qualifiers.BgHandler; import com.android.systemui.dagger.qualifiers.Background; import java.util.Map; import java.util.concurrent.Executor; import javax.inject.Inject; import javax.inject.Singleton; Loading @@ -49,10 +48,10 @@ public class FeatureFlags { private final Map<String, Boolean> mCachedDeviceConfigFlags = new ArrayMap<>(); @Inject public FeatureFlags(@BgHandler Handler bgHandler) { public FeatureFlags(@Background Executor executor) { DeviceConfig.addOnPropertiesChangedListener( "systemui", new HandlerExecutor(bgHandler), executor, this::onPropertiesChanged); } Loading