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

Commit cb56bacf authored by Dave Mankoff's avatar Dave Mankoff
Browse files

Revert^2 "Add injection to ClockProvider."

07b57218

Change-Id: I87c5edcb8c713b0364c0fe9f744357824eeb8e9d
parent 03bfd50a
Loading
Loading
Loading
Loading
+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();
    }
}
+9 −11
Original line number Diff line number Diff line
@@ -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.
@@ -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
@@ -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()
@@ -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);
+6 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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);
}
+2 −0
Original line number Diff line number Diff line
@@ -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;
@@ -90,6 +91,7 @@ import dagger.Provides;
@Module(includes = {
            AppOpsModule.class,
            AssistModule.class,
            ClockModule.class,
            ControlsModule.class,
            DemoModeModule.class,
            FalsingModule.class,