Android11 添加自定义物理按键事件监听回调
硬件平台:QCS6125
软件平台:Android11
新增了一个物理按键,需要在围绕这个物理按键的单击、双击、长按、组合键事件触发不同的功能入口。
直接上framework层改动:
diff --git a/api/current.txt b/api/current.txt
index 8077ad5..1cd18b0 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -61657,13 +61657,24 @@public class InkPlatformManager {ctor public InkPlatformManager(android.content.Context, android.yuanfudao.platform.IInkPlatformManager);
+ method public void addOnCameraKeyListener(@NonNull android.yuanfudao.platform.InkPlatformManager.OnCameraKeyListener);
+ method public void addOnCameraKeyListener(@NonNull android.yuanfudao.platform.InkPlatformManager.OnCameraKeyListener, @Nullable android.os.Handler);method public void configYfdSettings();method public boolean isAdbActive();
+ method public void removeOnCameraKeyListener(@NonNull android.yuanfudao.platform.InkPlatformManager.OnCameraKeyListener);method public boolean stealthilyCheckWhetherNeedTurnOffTheLight();method public boolean stealthilyTurnOffTheLight();method public void writeAdbSetting(boolean);}+ public static interface InkPlatformManager.OnCameraKeyListener {
+ method public default void onCameraAndVolumeDownKey();
+ method public default void onCameraAndVolumeUpKey();
+ method public void onCameraKeyDoublePress();
+ method public void onCameraKeyLongPress();
+ method public void onCameraKeyShortPress();
+ }
+}package android.yuanfudao.util {
diff --git a/core/java/android/yuanfudao/platform/IInkPlatformManager.aidl b/core/java/android/yuanfudao/platform/IInkPlatformManager.aidl
index f28f66e..40d6934 100755
--- a/core/java/android/yuanfudao/platform/IInkPlatformManager.aidl
+++ b/core/java/android/yuanfudao/platform/IInkPlatformManager.aidl
@@ -1,10 +1,25 @@package android.yuanfudao.platform;
-
-
+
+import android.yuanfudao.platform.IOnCameraKeyListener;
+interface IInkPlatformManager {void writeAdbSetting(boolean enabled);
- boolean isAdbActive();
+ boolean isAdbActive();void configYfdSettings();boolean stealthilyCheckWhetherNeedTurnOffTheLight();boolean stealthilyTurnOffTheLight();
+
+ /**
+ * Register camera key listener.
+ * @param listener the IOnCameraKeyListener to be notified.
+ * {@hide}
+ */
+ boolean registerOnCameraKeyListener(in IOnCameraKeyListener listener);
+
+ /**
+ * Unregister camera key listener.
+ * @param listener the IOnCameraKeyListener to be notified.
+ * {@hide}
+ */
+ boolean unregisterOnCameraKeyListener(in IOnCameraKeyListener listener);}
diff --git a/core/java/android/yuanfudao/platform/IOnCameraKeyListener.aidl b/core/java/android/yuanfudao/platform/IOnCameraKeyListener.aidl
new file mode 100644
index 0000000..d672431
--- /dev/null
+++ b/core/java/android/yuanfudao/platform/IOnCameraKeyListener.aidl
@@ -0,0 +1,28 @@
+/* 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 android.yuanfudao.platform;
+
+/**
+ * Listener to handle camera key.
+ * @hide
+ */
+oneway interface IOnCameraKeyListener {
+ void onCameraKeyShortPress();
+ void onCameraKeyDoublePress();
+ void onCameraKeyLongPress();
+ void onCameraAndVolumeUpKey();
+ void onCameraAndVolumeDownKey();
+}
diff --git a/core/java/android/yuanfudao/platform/InkPlatformManager.java b/core/java/android/yuanfudao/platform/InkPlatformManager.java
index ca38b23..b0acb51 100755
--- a/core/java/android/yuanfudao/platform/InkPlatformManager.java
+++ b/core/java/android/yuanfudao/platform/InkPlatformManager.java
@@ -1,16 +1,22 @@package android.yuanfudao.platform;-import android.yuanfudao.platform.IInkPlatformManager;
-import android.os.RemoteException;
-import android.util.Log;
+import android.annotation.NonNull;
+import android.annotation.Nullable;import android.content.Context;
+import android.os.Handler;
+import android.os.RemoteException;
+import android.util.ArrayMap;
+import android.util.Log;public class InkPlatformManager {private static final String TAG = "InkPlatformManager";private final IInkPlatformManager mService;private final Context mContext;- public InkPlatformManager(Context context, IInkPlatformManager service){
+ private OnCameraKeyListenerImpl mOnCameraKeyListener;
+ private ArrayMap<OnCameraKeyListener, OnCameraKeyListenerImpl> mListenerMap = new ArrayMap<>();
+
+ public InkPlatformManager(Context context, IInkPlatformManager service) {mService = service;mContext = context;}
@@ -55,4 +61,166 @@} }+ /**
+ * Set the camera key listener.
+ *
+ * @param listener The camera key listener. {@code null} to reset.
+ */
+ public void addOnCameraKeyListener(@NonNull OnCameraKeyListener listener) {
+ addOnCameraKeyListener(listener, new Handler());
+ }
+
+ /**
+ * Set the camera key listener.
+ *
+ * @param listener The camera key listener. {@code null} to reset.
+ * @param handler The handler on which the listener should be invoked, or {@code null} if the
+ * listener should be invoked on the calling thread's looper.
+ */
+ public void addOnCameraKeyListener(
+ @NonNull OnCameraKeyListener listener, @Nullable Handler handler) {
+ Log.d(TAG, "addOnCameraKeyListener.");
+ if (listener == null || mListenerMap.containsKey(listener)) {
+ Log.d(TAG, "listener is null,or this listener has register,just return.");
+ } else {
+
+ if (handler == null) {
+ handler = new Handler();
+ }
+
+ OnCameraKeyListenerImpl listenerImpl = new OnCameraKeyListenerImpl(listener, handler);
+ try {
+ if (mService.registerOnCameraKeyListener(listenerImpl)) {
+ Log.d(TAG, "addOnCameraKeyListener successfully.");
+ mListenerMap.put(listener, listenerImpl);
+ } else {
+ throw new RuntimeException("Listener failed to set");
+ }
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+ }
+
+ /**
+ * Remove the camera key listener.
+ *
+ * @param listener The camera key listener. {@code null} to reset.
+ */
+ public void removeOnCameraKeyListener(@NonNull OnCameraKeyListener listener) {
+ Log.d(TAG, "removeOnCameraKeyListener.");
+ if (listener == null || !(mListenerMap.containsKey(listener))) {
+ Log.d(TAG, "listener is null,or this listener has not register,just return.");
+ } else {
+ OnCameraKeyListenerImpl listenerImpl = mListenerMap.get(listener);
+ try {
+ if (mService.unregisterOnCameraKeyListener(listenerImpl)) {
+ Log.d(TAG, "removeOnCameraKeyListener successfully.");
+ mListenerMap.remove(listener);
+ } else {
+ throw new RuntimeException("Listener failed to remove");
+ }
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+ }
+
+ /** Listens the camera key. */
+ public interface OnCameraKeyListener {
+ void onCameraKeyShortPress();
+
+ void onCameraKeyDoublePress();
+
+ void onCameraKeyLongPress();
+
+ default void onCameraAndVolumeUpKey() {}
+
+ default void onCameraAndVolumeDownKey() {}
+ }
+
+ private static final class OnCameraKeyListenerImpl extends IOnCameraKeyListener.Stub {
+ private OnCameraKeyListener mListener;
+ private Handler mHandler;
+
+ public OnCameraKeyListenerImpl(OnCameraKeyListener listener, Handler handler) {
+ mListener = listener;
+ mHandler = handler;
+ }
+
+ @Override
+ public void onCameraKeyShortPress() {
+ if (mListener == null || mHandler == null) {
+ Log.w(
+ TAG,
+ "Failed to call camera key listener. Either mListener or mHandler is null");
+ } else {
+ mHandler.post(
+ () -> {
+ mListener.onCameraKeyShortPress();
+ Log.d(TAG, "The camera key short press.");
+ });
+ }
+ }
+
+ @Override
+ public void onCameraKeyDoublePress() {
+ if (mListener == null || mHandler == null) {
+ Log.w(
+ TAG,
+ "Failed to call camera key listener. Either mListener or mHandler is null");
+ } else {
+ mHandler.post(
+ () -> {
+ mListener.onCameraKeyDoublePress();
+ Log.d(TAG, "The camera key double press.");
+ });
+ }
+ }
+
+ @Override
+ public void onCameraKeyLongPress() {
+ if (mListener == null || mHandler == null) {
+ Log.w(
+ TAG,
+ "Failed to call camera key listener. Either mListener or mHandler is null");
+ } else {
+ mHandler.post(
+ () -> {
+ mListener.onCameraKeyLongPress();
+ Log.d(TAG, "The camera key long press.");
+ });
+ }
+ }
+
+ @Override
+ public void onCameraAndVolumeUpKey() {
+ if (mListener == null || mHandler == null) {
+ Log.w(
+ TAG,
+ "Failed to call camera key listener. Either mListener or mHandler is null");
+ } else {
+ mHandler.post(
+ () -> {
+ mListener.onCameraAndVolumeUpKey();
+ Log.d(TAG, "The camera and volume up key listener is returned.");
+ });
+ }
+ }
+
+ @Override
+ public void onCameraAndVolumeDownKey() {
+ if (mListener == null || mHandler == null) {
+ Log.w(
+ TAG,
+ "Failed to call camera key listener. Either mListener or mHandler is null");
+ } else {
+ mHandler.post(
+ () -> {
+ mListener.onCameraAndVolumeDownKey();
+ Log.d(TAG, "The camera and volume down key listener is returned.");
+ });
+ }
+ }
+ }}
diff --git a/core/java/android/yuanfudao/platform/InkPlatformManagerInternal.java b/core/java/android/yuanfudao/platform/InkPlatformManagerInternal.java
new file mode 100644
index 0000000..5248420
--- /dev/null
+++ b/core/java/android/yuanfudao/platform/InkPlatformManagerInternal.java
@@ -0,0 +1,18 @@
+package android.yuanfudao.platform;
+
+/**
+ * ink platform manager local system service interface.
+ *
+ * @hide Only for use within the system server.
+ */
+public abstract class InkPlatformManagerInternal {
+ public abstract void onCameraKeyShortPress();
+
+ public abstract void onCameraKeyDoublePress();
+
+ public abstract void onCameraKeyLongPress();
+
+ public abstract void onCameraAndVolumeUpKey();
+
+ public abstract void onCameraAndVolumeDownKey();
+}
diff --git a/non-updatable-api/current.txt b/non-updatable-api/current.txt
index ba6529c..1387530 100644
--- a/non-updatable-api/current.txt
+++ b/non-updatable-api/current.txt
@@ -59817,13 +59817,24 @@public class InkPlatformManager {ctor public InkPlatformManager(android.content.Context, android.yuanfudao.platform.IInkPlatformManager);
+ method public void addOnCameraKeyListener(@NonNull android.yuanfudao.platform.InkPlatformManager.OnCameraKeyListener);
+ method public void addOnCameraKeyListener(@NonNull android.yuanfudao.platform.InkPlatformManager.OnCameraKeyListener, @Nullable android.os.Handler);method public void configYfdSettings();method public boolean isAdbActive();
+ method public void removeOnCameraKeyListener(@NonNull android.yuanfudao.platform.InkPlatformManager.OnCameraKeyListener);method public boolean stealthilyCheckWhetherNeedTurnOffTheLight();method public boolean stealthilyTurnOffTheLight();method public void writeAdbSetting(boolean);} + public static interface InkPlatformManager.OnCameraKeyListener {
+ method public default void onCameraAndVolumeDownKey();
+ method public default void onCameraAndVolumeUpKey();
+ method public void onCameraKeyDoublePress();
+ method public void onCameraKeyLongPress();
+ method public void onCameraKeyShortPress();
+ }
+}package android.yuanfudao.util {
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 33ab33a..51ad6fa 100755
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -93,14 +93,12 @@import android.app.ActivityManager;import android.app.ActivityManagerInternal;import android.app.ActivityTaskManager;
-import android.app.AlarmManager;import android.app.AppOpsManager;import android.app.IUiModeManager;import android.app.NotificationManager;import android.app.ProgressDialog;import android.app.SearchManager;import android.app.UiModeManager;
-import android.bluetooth.BluetoothManager;import android.content.ActivityNotFoundException;import android.content.BroadcastReceiver;import android.content.ContentResolver;
@@ -130,7 +128,6 @@import android.media.AudioSystem;import android.media.IAudioService;import android.media.session.MediaSessionLegacyHelper;
-import android.net.wifi.WifiManager;import android.os.Binder;import android.os.Bundle;import android.os.FactoryTest;
@@ -189,6 +186,7 @@import android.view.animation.AnimationSet;import android.view.animation.AnimationUtils;import android.view.autofill.AutofillManagerInternal;
+import android.yuanfudao.platform.InkPlatformManagerInternal;import android.yuanfudao.util.CommonUtils;import com.android.internal.R;
@@ -388,6 +386,8 @@private boolean mHasFeatureWatch;private boolean mHasFeatureLeanback;private boolean mHasFeatureHdmiCec;
+ private CameraButtonHandler mCameraButtonHandler;
+ private InkPlatformManagerInternal mInkPlatformManagerInternal;// Assigned on main thread, accessed on UI threadvolatile VrManagerInternal mVrManagerInternal;
@@ -895,6 +895,15 @@}}+ InkPlatformManagerInternal getInkPlatformManagerInternal() {
+ synchronized (mServiceAquireLock) {
+ if (mInkPlatformManagerInternal == null) {
+ mInkPlatformManagerInternal = LocalServices.getService(InkPlatformManagerInternal.class);
+ }
+ return mInkPlatformManagerInternal;
+ }
+ }private void interceptBackKeyDown() { mLogger.count("key_back_down", 1);// Reset back key state for long press
@@ -1764,6 +1773,95 @@}}+ /** A handler to handle camera keys per display */
+ private class CameraButtonHandler {
+ private boolean mCameraDoubleTapPending;
+ private boolean mCameraPressed;
+ private boolean mCameraConsumed;
+ private int mCameraKeyPressCounter;
+
+ private final Runnable mCameraDoubleTapTimeoutRunnable =
+ () -> {
+ if (mCameraDoubleTapPending) {
+ mCameraDoubleTapPending = false;
+ handleShortPressOnCamera();
+ }
+ };
+
+ private final Runnable mCameraLongPressRunnable = () -> handleLongPressOnCamera();
+
+ void handleCameraButton(KeyEvent event) {
+ final boolean keyguardOn = keyguardOn();
+ final boolean down = event.getAction() == KeyEvent.ACTION_DOWN;
+ final boolean canceled = event.isCanceled();
+
+ if (DEBUG_INPUT) {
+ Log.d(TAG, "handleCameraButton event = " + event);
+ }
+
+ // If we have released the camera key, and didn't do anything else
+ // while it was pressed, then it is time to go camera!
+ if (down) {
+ // Remember that camera is pressed and handle special actions.
+ mCameraPressed = true;
+ if (mCameraKeyPressCounter == 0) {
+ if ((event.getFlags() & KeyEvent.FLAG_LONG_PRESS) != 0) {
+ mHandler.post(() -> handleLongPressOnCamera());
+ } else {
+ mHandler.postDelayed(mCameraLongPressRunnable, 1000);
+ }
+ } else {
+ if (mCameraDoubleTapPending) {
+ mCameraDoubleTapPending = false;
+ mHandler.removeCallbacks(mCameraDoubleTapTimeoutRunnable);
+ mHandler.post(() -> handleDoubleTapOnCamera());
+ }
+ }
+ } else {
+ mCameraPressed = false;
+ mCameraKeyPressCounter++;
+ mHandler.removeCallbacks(mCameraLongPressRunnable);
+
+ if (mCameraConsumed) {
+ mCameraConsumed = false;
+ mCameraKeyPressCounter = 0;
+ return;
+ }
+
+ if (canceled) {
+ Log.i(TAG, "Ignoring CAMERA; event canceled.");
+ return;
+ }
+
+ // Delay handling camera if a double-tap is possible.
+ mHandler.removeCallbacks(mCameraDoubleTapTimeoutRunnable); // just in case
+ mCameraDoubleTapPending = true;
+ mHandler.postDelayed(
+ mCameraDoubleTapTimeoutRunnable, ViewConfiguration.getDoubleTapTimeout());
+ }
+ }
+
+ private void handleShortPressOnCamera() {
+ mCameraKeyPressCounter = 0;
+ getInkPlatformManagerInternal().onCameraKeyShortPress();
+ }
+
+ private void handleDoubleTapOnCamera() {
+ mCameraConsumed = true;
+ getInkPlatformManagerInternal().onCameraKeyDoublePress();
+ }
+
+ private void handleLongPressOnCamera() {
+ mCameraConsumed = true;
+ getInkPlatformManagerInternal().onCameraKeyLongPress();
+ }
+
+ @Override
+ public String toString() {
+ return "mCameraPressed = " + mCameraPressed;
+ }
+ }
+/** A DisplayHomeButtonHandler map indexed by display id */private final SparseArray<DisplayHomeButtonHandler> mDisplayHomeButtonHandlers =new SparseArray<>();
@@ -3924,29 +4022,22 @@break;}- case KeyEvent.KEYCODE_CAMERA: {
- result &= ~ACTION_PASS_TO_USER;
- if (down) {
- Log.e(TAG, "====== KeyEvent.KEYCODE_CAMERA down !!!");
- if (isScreenOn()) {
- Log.d(TAG, "====== Handling KeyEvent.KEYCODE_CAMERA down in framework!!!");
- Intent intent = new Intent("android.intent.action.YFD_KEYCODE_CAMERA");
- intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
- mContext.sendBroadcast(intent);
- CAMERA_KEY_COUNT += 1;
- openAdbAction();
- }else{
- Log.w(
- TAG,
- "====== Ignore KeyEvent.KEYCODE_CAMERA down, because the"
- + " current screen is off!!!");
+ case KeyEvent.KEYCODE_CAMERA:
+ {
+ if (SystemProperties.get("debug.keycode.camera.cit").equalsIgnoreCase("true")
+ && "userdebug"
+ .equals(SystemProperties.get("ro.build.type", "userdebug"))) {
+ Log.i(TAG, "keycode camera pressed in debug.");
+ return ACTION_PASS_TO_USER;}- } /*else {
- Log.e(TAG, "====== KeyEvent.KEYCODE_CAMERA up !!!");
- }*/
- break;
- }
+ result &= ~ACTION_PASS_TO_USER;
+ if (mCameraButtonHandler == null) {
+ mCameraButtonHandler = new CameraButtonHandler();
+ }
+ mCameraButtonHandler.handleCameraButton(event);
+ break;
+ }case KeyEvent.KEYCODE_SYSTEM_NAVIGATION_DOWN:// fall through
diff --git a/services/core/java/com/android/server/yfd/InkPlatformManagerService.java b/services/core/java/com/android/server/yfd/InkPlatformManagerService.java
index a36c7a6..3d7ae3b 100755
--- a/services/core/java/com/android/server/yfd/InkPlatformManagerService.java
+++ b/services/core/java/com/android/server/yfd/InkPlatformManagerService.java
@@ -1,22 +1,25 @@package com.android.server.yfd;-import android.os.Build;
-import android.os.Binder;
-import android.os.RemoteException;
-import android.os.SystemProperties;
-import android.content.ContentResolver;import android.content.BroadcastReceiver;
+import android.content.ContentResolver;import android.content.Context;import android.content.Intent;import android.content.IntentFilter;
+import android.os.Binder;
+import android.os.Build;
+import android.os.RemoteCallbackList;
+import android.os.RemoteException;
+import android.os.SystemProperties;
+import android.provider.Settings;
+import android.text.TextUtils;import android.util.Slog;import android.yuanfudao.platform.IInkPlatformManager;
-
-import android.provider.Settings;
-
-import com.android.settingslib.development.DevelopmentSettingsEnabler;
+import android.yuanfudao.platform.IOnCameraKeyListener;
+import android.yuanfudao.platform.InkPlatformManagerInternal;import android.yuanfudao.util.YuanFuDaoLightUtil;
-import android.text.TextUtils;
+
+import com.android.server.LocalServices;
+import com.android.settingslib.development.DevelopmentSettingsEnabler;public class InkPlatformManagerService extends IInkPlatformManager.Stub {private Context mContext;
@@ -29,32 +32,36 @@public static final int ADB_SETTING_ON = 1;public static final int ADB_SETTING_OFF = 0;+ private RemoteCallbackList<IOnCameraKeyListener> mListenerList = new RemoteCallbackList<>();
++ @Override
+ public boolean registerOnCameraKeyListener(IOnCameraKeyListener listener)
+ throws RemoteException {
+ boolean result = false;
+ final long token = Binder.clearCallingIdentity();
+ try {
+ result = mListenerList.register(listener);
+ return result;
+ } finally {
+ Slog.d(TAG, "registerOnCameraKeyListener: result=" + result);
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ @Override
+ public boolean unregisterOnCameraKeyListener(IOnCameraKeyListener listener)
+ throws RemoteException {
+ boolean result = false;
+ final long token = Binder.clearCallingIdentity();
+ try {
+ result = mListenerList.unregister(listener);
+ return result;
+ } finally {
+ Slog.d(TAG, "unregisterOnCameraKeyListener: result=" + result);
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ private final class LocalService extends InkPlatformManagerInternal {
+ @Override
+ public void onCameraKeyShortPress() {
+ final int N = mListenerList.beginBroadcast();
+ for (int i = 0; i < N; i++) {
+ IOnCameraKeyListener listener = mListenerList.getBroadcastItem(i);
+ try {
+ listener.onCameraKeyShortPress();
+ } catch (RemoteException e) {
+ Slog.w(TAG, "RemoteException in onCameraKeyShortPress", e);
+ }
+ }
+ mListenerList.finishBroadcast();
+ }
+
+ @Override
+ public void onCameraKeyDoublePress() {
+ final int N = mListenerList.beginBroadcast();
+ for (int i = 0; i < N; i++) {
+ IOnCameraKeyListener listener = mListenerList.getBroadcastItem(i);
+ try {
+ listener.onCameraKeyDoublePress();
+ } catch (RemoteException e) {
+ Slog.w(TAG, "RemoteException in onCameraKeyDoublePress", e);
+ }
+ }
+ mListenerList.finishBroadcast();
+ }
+
+ @Override
+ public void onCameraKeyLongPress() {
+ final int N = mListenerList.beginBroadcast();
+ for (int i = 0; i < N; i++) {
+ IOnCameraKeyListener listener = mListenerList.getBroadcastItem(i);
+ try {
+ listener.onCameraKeyLongPress();
+ } catch (RemoteException e) {
+ Slog.w(TAG, "RemoteException in onCameraKeyLongPress", e);
+ }
+ }
+ mListenerList.finishBroadcast();
+ }
+
+ @Override
+ public void onCameraAndVolumeUpKey() {
+ final int N = mListenerList.beginBroadcast();
+ for (int i = 0; i < N; i++) {
+ IOnCameraKeyListener listener = mListenerList.getBroadcastItem(i);
+ try {
+ listener.onCameraAndVolumeUpKey();
+ } catch (RemoteException e) {
+ Slog.w(TAG, "RemoteException in onCameraAndVolumeUpKey", e);
+ }
+ }
+ mListenerList.finishBroadcast();
+ }
+
+ @Override
+ public void onCameraAndVolumeDownKey() {
+ final int N = mListenerList.beginBroadcast();
+ for (int i = 0; i < N; i++) {
+ IOnCameraKeyListener listener = mListenerList.getBroadcastItem(i);
+ try {
+ listener.onCameraAndVolumeDownKey();
+ } catch (RemoteException e) {
+ Slog.w(TAG, "RemoteException in onCameraAndVolumeDownKey", e);
+ }
+ }
+ mListenerList.finishBroadcast();
+ }
+ }}
Mark~~~