Loading packages/SystemUI/src/com/android/keyguard/clock/ClockModule.java 0 → 100644 +33 −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.keyguard.clock; import java.util.List; import dagger.Module; import dagger.Provides; /** Dagger Module for clock package. */ @Module public abstract class ClockModule { /** */ @Provides public static List<ClockInfo> provideClockInfoList(ClockManager clockManager) { return clockManager.getClockInfos(); } } packages/SystemUI/src/com/android/keyguard/clock/ClockOptionsProvider.java +9 −11 Original line number Diff line number Diff line Loading @@ -28,11 +28,12 @@ import android.text.TextUtils; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.Dependency; import java.io.FileNotFoundException; import java.util.List; import java.util.function.Supplier; import javax.inject.Inject; import javax.inject.Provider; /** * Exposes custom clock face options and provides realistic preview images. Loading Loading @@ -65,15 +66,12 @@ public final class ClockOptionsProvider extends ContentProvider { private static final String CONTENT_SCHEME = "content"; private static final String AUTHORITY = "com.android.keyguard.clock"; private final Supplier<List<ClockInfo>> mClocksSupplier; public ClockOptionsProvider() { this(() -> Dependency.get(ClockManager.class).getClockInfos()); } @Inject public Provider<List<ClockInfo>> mClockInfosProvider; @VisibleForTesting ClockOptionsProvider(Supplier<List<ClockInfo>> clocksSupplier) { mClocksSupplier = clocksSupplier; ClockOptionsProvider(Provider<List<ClockInfo>> clockInfosProvider) { mClockInfosProvider = clockInfosProvider; } @Override Loading @@ -99,7 +97,7 @@ public final class ClockOptionsProvider extends ContentProvider { } MatrixCursor cursor = new MatrixCursor(new String[] { COLUMN_NAME, COLUMN_TITLE, COLUMN_ID, COLUMN_THUMBNAIL, COLUMN_PREVIEW}); List<ClockInfo> clocks = mClocksSupplier.get(); List<ClockInfo> clocks = mClockInfosProvider.get(); for (int i = 0; i < clocks.size(); i++) { ClockInfo clock = clocks.get(i); cursor.newRow() Loading Loading @@ -139,7 +137,7 @@ public final class ClockOptionsProvider extends ContentProvider { throw new FileNotFoundException("Invalid preview url, missing id"); } ClockInfo clock = null; List<ClockInfo> clocks = mClocksSupplier.get(); List<ClockInfo> clocks = mClockInfosProvider.get(); for (int i = 0; i < clocks.size(); i++) { if (id.equals(clocks.get(i).getId())) { clock = clocks.get(i); Loading packages/SystemUI/src/com/android/systemui/dagger/SysUIComponent.java +6 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.dagger; import com.android.keyguard.clock.ClockOptionsProvider; import com.android.systemui.BootCompleteCacheImpl; import com.android.systemui.Dependency; import com.android.systemui.InitController; Loading Loading @@ -150,4 +151,9 @@ public interface SysUIComponent { * Member injection into the supplied argument. */ void inject(KeyguardSliceProvider keyguardSliceProvider); /** * Member injection into the supplied argument. */ void inject(ClockOptionsProvider clockOptionsProvider); } packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.Context; import androidx.annotation.Nullable; import com.android.internal.statusbar.IStatusBarService; import com.android.keyguard.clock.ClockModule; import com.android.keyguard.dagger.KeyguardBouncerComponent; import com.android.systemui.BootCompleteCache; import com.android.systemui.BootCompleteCacheImpl; Loading Loading @@ -90,6 +91,7 @@ import dagger.Provides; @Module(includes = { AppOpsModule.class, AssistModule.class, ClockModule.class, ControlsModule.class, DemoModeModule.class, FalsingModule.class, Loading Loading
packages/SystemUI/src/com/android/keyguard/clock/ClockModule.java 0 → 100644 +33 −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.keyguard.clock; import java.util.List; import dagger.Module; import dagger.Provides; /** Dagger Module for clock package. */ @Module public abstract class ClockModule { /** */ @Provides public static List<ClockInfo> provideClockInfoList(ClockManager clockManager) { return clockManager.getClockInfos(); } }
packages/SystemUI/src/com/android/keyguard/clock/ClockOptionsProvider.java +9 −11 Original line number Diff line number Diff line Loading @@ -28,11 +28,12 @@ import android.text.TextUtils; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.Dependency; import java.io.FileNotFoundException; import java.util.List; import java.util.function.Supplier; import javax.inject.Inject; import javax.inject.Provider; /** * Exposes custom clock face options and provides realistic preview images. Loading Loading @@ -65,15 +66,12 @@ public final class ClockOptionsProvider extends ContentProvider { private static final String CONTENT_SCHEME = "content"; private static final String AUTHORITY = "com.android.keyguard.clock"; private final Supplier<List<ClockInfo>> mClocksSupplier; public ClockOptionsProvider() { this(() -> Dependency.get(ClockManager.class).getClockInfos()); } @Inject public Provider<List<ClockInfo>> mClockInfosProvider; @VisibleForTesting ClockOptionsProvider(Supplier<List<ClockInfo>> clocksSupplier) { mClocksSupplier = clocksSupplier; ClockOptionsProvider(Provider<List<ClockInfo>> clockInfosProvider) { mClockInfosProvider = clockInfosProvider; } @Override Loading @@ -99,7 +97,7 @@ public final class ClockOptionsProvider extends ContentProvider { } MatrixCursor cursor = new MatrixCursor(new String[] { COLUMN_NAME, COLUMN_TITLE, COLUMN_ID, COLUMN_THUMBNAIL, COLUMN_PREVIEW}); List<ClockInfo> clocks = mClocksSupplier.get(); List<ClockInfo> clocks = mClockInfosProvider.get(); for (int i = 0; i < clocks.size(); i++) { ClockInfo clock = clocks.get(i); cursor.newRow() Loading Loading @@ -139,7 +137,7 @@ public final class ClockOptionsProvider extends ContentProvider { throw new FileNotFoundException("Invalid preview url, missing id"); } ClockInfo clock = null; List<ClockInfo> clocks = mClocksSupplier.get(); List<ClockInfo> clocks = mClockInfosProvider.get(); for (int i = 0; i < clocks.size(); i++) { if (id.equals(clocks.get(i).getId())) { clock = clocks.get(i); Loading
packages/SystemUI/src/com/android/systemui/dagger/SysUIComponent.java +6 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.dagger; import com.android.keyguard.clock.ClockOptionsProvider; import com.android.systemui.BootCompleteCacheImpl; import com.android.systemui.Dependency; import com.android.systemui.InitController; Loading Loading @@ -150,4 +151,9 @@ public interface SysUIComponent { * Member injection into the supplied argument. */ void inject(KeyguardSliceProvider keyguardSliceProvider); /** * Member injection into the supplied argument. */ void inject(ClockOptionsProvider clockOptionsProvider); }
packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.Context; import androidx.annotation.Nullable; import com.android.internal.statusbar.IStatusBarService; import com.android.keyguard.clock.ClockModule; import com.android.keyguard.dagger.KeyguardBouncerComponent; import com.android.systemui.BootCompleteCache; import com.android.systemui.BootCompleteCacheImpl; Loading Loading @@ -90,6 +91,7 @@ import dagger.Provides; @Module(includes = { AppOpsModule.class, AssistModule.class, ClockModule.class, ControlsModule.class, DemoModeModule.class, FalsingModule.class, Loading