Revert "Add injection to ClockProvider."

Revert submission 13536242-b179775696-depenency-get-keyguard

Reason for revert: Candidate reversion for broken tests: b/180440298
Reverted Changes:
I6d0271692:Add ViewController to CarrierText.
I4d9a4a21f:Add Controller for Emergency Button.
I4c76d99f9:Remove Dependency.get from KeyguardSliceTextView.
I730593fcf:Add injection to ClockProvider.
Ifbb93e624:Remove Dependency.get from KeyguardStatusView.
I237215456:Remove final calls to Dependency.get from keyguard...

Change-Id: I30a044a70ebcc785d3a7f69d80e7bf2129b20aa8
This commit is contained in:
Alec Mouri
2021-02-17 00:18:55 +00:00
committed by Dave Mankoff
parent 3f652cb990
commit 07b5721883
4 changed files with 11 additions and 50 deletions

View File

@@ -1,33 +0,0 @@
/*
* 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();
}
}

View File

@@ -28,12 +28,11 @@ 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 javax.inject.Inject;
import javax.inject.Provider;
import java.util.function.Supplier;
/**
* Exposes custom clock face options and provides realistic preview images.
@@ -66,12 +65,15 @@ public final class ClockOptionsProvider extends ContentProvider {
private static final String CONTENT_SCHEME = "content";
private static final String AUTHORITY = "com.android.keyguard.clock";
@Inject
public Provider<List<ClockInfo>> mClockInfosProvider;
private final Supplier<List<ClockInfo>> mClocksSupplier;
public ClockOptionsProvider() {
this(() -> Dependency.get(ClockManager.class).getClockInfos());
}
@VisibleForTesting
ClockOptionsProvider(Provider<List<ClockInfo>> clockInfosProvider) {
mClockInfosProvider = clockInfosProvider;
ClockOptionsProvider(Supplier<List<ClockInfo>> clocksSupplier) {
mClocksSupplier = clocksSupplier;
}
@Override
@@ -97,7 +99,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 = mClockInfosProvider.get();
List<ClockInfo> clocks = mClocksSupplier.get();
for (int i = 0; i < clocks.size(); i++) {
ClockInfo clock = clocks.get(i);
cursor.newRow()
@@ -137,7 +139,7 @@ public final class ClockOptionsProvider extends ContentProvider {
throw new FileNotFoundException("Invalid preview url, missing id");
}
ClockInfo clock = null;
List<ClockInfo> clocks = mClockInfosProvider.get();
List<ClockInfo> clocks = mClocksSupplier.get();
for (int i = 0; i < clocks.size(); i++) {
if (id.equals(clocks.get(i).getId())) {
clock = clocks.get(i);

View File

@@ -16,7 +16,6 @@
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;
@@ -147,9 +146,4 @@ public interface SysUIComponent {
* Member injection into the supplied argument.
*/
void inject(KeyguardSliceProvider keyguardSliceProvider);
/**
* Member injection into the supplied argument.
*/
void inject(ClockOptionsProvider clockOptionsProvider);
}

View File

@@ -22,7 +22,6 @@ 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;
@@ -91,7 +90,6 @@ import dagger.Provides;
@Module(includes = {
AppOpsModule.class,
AssistModule.class,
ClockModule.class,
ControlsModule.class,
DemoModeModule.class,
FalsingModule.class,