Android framwork 锁屏界面开发 笔记

代码路劲:
frameworks/base/packages/SystemUI/src/com/android/systemui/ SystemUI

  //mingshine 锁屏界面
    protected void inflateStatusBarWindow(Context context) {
        mStatusBarWindow = (StatusBarWindowView) View.inflate(context,
                R.layout.super_status_bar, null);
    }

super_status_bar.xml 这个页面是锁屏页面

keyguard_bottom_area.xml 在这个xml文件中布局自己的锁屏界面
KeyguardBottomAreaView.java 在这个里面敲代码(锁屏代码逻辑在这个java类中处理)

StatusBarWindowView 事件处理 关键代码如下:

    case KeyEvent.KEYCODE_STAR: {
                if (down) {
                    if (event.getRepeatCount() == 0) {
                        mLongPressStarKey = false;
                    } else if (event.isLongPress()) {
                        Log.d(TAG, "KeyEvent.KEYCODE_STAR, ACTION_DOWN, Long Press");
                        mLongPressStarKey = true;
                        //acquire wake lock for long press of "*" unles a keyup happens for the same
                        if (mWakeLock != null) {
                            mWakeLock.acquire();
                        }
                    }
                    return true;
                } else if (event.getAction() == KeyEvent.ACTION_UP) {
                    if (mLongPressStarKey) {
                        Log.d(TAG, "KeyEvent.KEYCODE_STAR, ACTION_UP");
                        //release wake lock since we have detected a keyup for long press of "*"
                        if (mWakeLock != null && mWakeLock.isHeld()) {
                            mWakeLock.release();
                        }
                        mService.onSpacePressed();
                        mLongPressStarKey = false;
                        return true;
                    }
                    break;
                }
            }

Android framwork 锁屏界面开发 笔记_第1张图片

左上按键序号:82 :KEYCODE_MENU

你可能感兴趣的:(Android,Framework)