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

Commit abce5bec authored by Joshua Mokut's avatar Joshua Mokut Committed by Android (Google) Code Review
Browse files

Merge "Removed KeyboardShortcutsReceiver and KeyboardShortcutsModule" into main

parents f80cdfcd f783f0ca
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -1100,16 +1100,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);
    }
}