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

Commit 94ce94e9 authored by Muyuan Li's avatar Muyuan Li
Browse files

Allows components to register shortcut key.

The registered shortcut will be called from PhoneWindowManager,
before dispatching

Change-Id: If26128939b45a639c8895719a7a23ca433f39fd9
(cherry picked from commit 4da863c5a8872dcabb179a978a2b2157d9081679)
parent 203b3530
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -311,6 +311,7 @@ LOCAL_SRC_FILES += \
	core/java/com/android/internal/policy/IKeyguardExitCallback.aidl \
	core/java/com/android/internal/policy/IKeyguardService.aidl \
	core/java/com/android/internal/policy/IKeyguardStateCallback.aidl \
	core/java/com/android/internal/policy/IShortcutService.aidl \
	core/java/com/android/internal/os/IDropBoxManagerService.aidl \
	core/java/com/android/internal/os/IParcelFileDescriptorFactory.aidl \
	core/java/com/android/internal/os/IResultReceiver.aidl \
+8 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import com.android.internal.app.IAssistScreenshotReceiver;
import com.android.internal.os.IResultReceiver;
import com.android.internal.view.IInputContext;
import com.android.internal.view.IInputMethodClient;
import com.android.internal.policy.IShortcutService;

import android.content.res.CompatibilityInfo;
import android.content.res.Configuration;
@@ -387,4 +388,11 @@ interface IWindowManager
     * Retrieves the current stable insets from the primary display.
     */
    void getStableInsets(out Rect outInsets);

    /**
     * Register shortcut key. Shortcut code is packed as:
     * (MetaState << Integer.SIZE) | KeyCode
     * @hide
     */
    void registerShortcutKey(in long shortcutCode, IShortcutService keySubscriber);
}
+10 −0
Original line number Diff line number Diff line
@@ -29,7 +29,9 @@ import android.graphics.RectF;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import android.view.animation.Animation;
import com.android.internal.policy.IShortcutService;

import java.io.PrintWriter;
import java.lang.annotation.Retention;
@@ -120,6 +122,14 @@ public interface WindowManagerPolicy {
     */
    public final static int ACTION_PASS_TO_USER = 0x00000001;

    /**
     * Register shortcuts for window manager to dispatch.
     * Shortcut code is packed as (metaState << Integer.SIZE) | keyCode
     * @hide
     */
    void registerShortcutKey(long shortcutCode, IShortcutService shortcutKeyReceiver)
            throws RemoteException;

    /**
     * Interface to the Window Manager state associated with a particular
     * window.  You can hold on to an instance of this interface from the call
+29 −0
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.internal.policy;

/**
 * An interface to notify the shortcut service that a shortcut key is pressed
 * @hide
 */
oneway interface IShortcutService {
    /**
     * @param shortcutCode the keycode packed with meta information
     */
    void notifyShortcutKeyPressed(long shortcutCode);
}
+5 −2
Original line number Diff line number Diff line
@@ -54,7 +54,8 @@ public class SystemUIApplication extends Application {
            com.android.systemui.power.PowerUI.class,
            com.android.systemui.media.RingtonePlayer.class,
            com.android.systemui.keyboard.KeyboardUI.class,
            com.android.systemui.tv.pip.PipUI.class
            com.android.systemui.tv.pip.PipUI.class,
            com.android.systemui.shortcut.ShortcutKeyDispatcher.class
    };

    /**
@@ -143,12 +144,14 @@ public class SystemUIApplication extends Application {
            Class<?> cl = services[i];
            if (DEBUG) Log.d(TAG, "loading: " + cl);
            try {
                mServices[i] = (SystemUI) cl.newInstance();
                Object newService = SystemUIFactory.getInstance().createInstance(cl);
                mServices[i] = (SystemUI) ((newService == null) ? cl.newInstance() : newService);
            } catch (IllegalAccessException ex) {
                throw new RuntimeException(ex);
            } catch (InstantiationException ex) {
                throw new RuntimeException(ex);
            }

            mServices[i].mContext = this;
            mServices[i].mComponents = mComponents;
            if (DEBUG) Log.d(TAG, "running: " + mServices[i]);
Loading