路径:frameworks/base/services/core/java/com/android/server/am/UserController.java
设置是否显示摄像头图标(由有无摄像头决定)
++ public void setCamera(boolean state){
++ PackageManager p = mInjector.getContext().getPackageManager();
++ if(state){
++ p.setApplicationEnabledSetting("com.android.camera2", PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
++ }else{
++ p.setApplicationEnabledSetting("com.android.camera2", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
++ }
++ }
检查是否有摄像头
private void finishUserUnlockedCompleted(UserState uss) {
final int userId = uss.mHandle.getIdentifier();
EventLog.writeEvent(EventLogTags.UC_FINISH_USER_UNLOCKED_COMPLETED, userId);
++ int n = android.hardware.Camera.getNumberOfCameras();
++ if (n==0){
++ setCamera(false);
++ }else if(n>0){
++ setCamera(true);
++ }
}