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

Commit f783f0ca authored by Josh's avatar Josh
Browse files

Removed KeyboardShortcutsReceiver and KeyboardShortcutsModule

KeyboardShortcutsReceiver is now being replaced by
ShortcutHelperCoreStartable and the KeyboardShortcutsModule is replaced
by ShortcutHelperModule & ShortcutHelperDisplayModule

Flag: com.android.systemui.keyboard_shortcut_helper_rewrite
Test: Build Test
Bug: 435405563
Change-Id: I17177335b55b56473cffd48fc8afc452b0f1e639
parent 74dcc16a
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -1093,16 +1093,6 @@
                  android:exported="true">
        </provider>

        <receiver
            android:name=".statusbar.KeyboardShortcutsReceiver"
            android:visibleToInstantApps="true"
            android:exported="true">
            <intent-filter>
                <action android:name="com.android.intent.action.DISMISS_KEYBOARD_SHORTCUTS" />
                <action android:name="com.android.intent.action.SHOW_KEYBOARD_SHORTCUTS" />
            </intent-filter>
        </receiver>

        <receiver android:name=".media.dialog.MediaOutputDialogReceiver"
                  android:exported="true">
            <intent-filter android:priority="1">
+0 −2
Original line number Diff line number Diff line
@@ -76,7 +76,6 @@ import com.android.systemui.shade.NotificationShadeWindowControllerImpl;
import com.android.systemui.shade.ShadeModule;
import com.android.systemui.startable.Dependencies;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.KeyboardShortcutsModule;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationLockscreenUserManagerImpl;
import com.android.systemui.statusbar.NotificationShadeWindowController;
@@ -150,7 +149,6 @@ import javax.inject.Provider;
        GestureModule.class,
        HeadsUpModule.class,
        KeyguardModule.class,
        KeyboardShortcutsModule.class,
        KeyguardBlueprintModule.class,
        KeyguardSectionsModule.class,
        KeyboardTouchpadTutorialModule.class,
+0 −40
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.statusbar;

import android.content.BroadcastReceiver;

import dagger.Binds;
import dagger.Module;
import dagger.multibindings.ClassKey;
import dagger.multibindings.IntoMap;

/**
 * Module for {@link com.android.systemui.KeyboardShortcutsReceiver}.
 */
@Module
public abstract class KeyboardShortcutsModule {

    /**
     *
     */
    @Binds
    @IntoMap
    @ClassKey(KeyboardShortcutsReceiver.class)
    public abstract BroadcastReceiver bindKeyboardShortcutsReceiver(
            KeyboardShortcutsReceiver broadcastReceiver);
}
+0 −68
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 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.statusbar;

import static com.android.systemui.Flags.keyboardShortcutHelperRewrite;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags;
import com.android.systemui.shared.recents.utilities.Utilities;
import com.android.systemui.utils.windowmanager.WindowManagerProvider;

import javax.inject.Inject;

/** Receiver for the Keyboard Shortcuts Helper. */
public class KeyboardShortcutsReceiver extends BroadcastReceiver {

    private final FeatureFlags mFeatureFlags;
    private final WindowManagerProvider mWindowManagerProvider;

    @Inject
    public KeyboardShortcutsReceiver(FeatureFlags featureFlags,
            WindowManagerProvider windowManagerProvider) {
        mFeatureFlags = featureFlags;
        mWindowManagerProvider = windowManagerProvider;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        if (keyboardShortcutHelperRewrite()) {
            return;
        }
        if (isTabletLayoutFlagEnabled() && Utilities.isLargeScreen(context)) {
            if (Intent.ACTION_SHOW_KEYBOARD_SHORTCUTS.equals(intent.getAction())) {
                KeyboardShortcutListSearch.show(context, -1 /* deviceId unknown */,
                        mWindowManagerProvider);
            } else if (Intent.ACTION_DISMISS_KEYBOARD_SHORTCUTS.equals(intent.getAction())) {
                KeyboardShortcutListSearch.dismiss();
            }
        } else {
            if (Intent.ACTION_SHOW_KEYBOARD_SHORTCUTS.equals(intent.getAction())) {
                KeyboardShortcuts.show(context, -1 /* deviceId unknown */, mWindowManagerProvider);
            } else if (Intent.ACTION_DISMISS_KEYBOARD_SHORTCUTS.equals(intent.getAction())) {
                KeyboardShortcuts.dismiss();
            }
        }
    }

    private boolean isTabletLayoutFlagEnabled() {
        return mFeatureFlags.isEnabled(Flags.SHORTCUT_LIST_SEARCH_LAYOUT);
    }
}