Revert "sm8150-common: KeyHandler: handle camera motor key events"
This reverts commit 791f89485c
.
This commit is contained in:
parent
791f89485c
commit
c6fe0a637d
|
@ -26,8 +26,6 @@ LOCAL_PRIVATE_PLATFORM_APIS := true
|
|||
LOCAL_PRIVILEGED_MODULE := true
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
|
||||
|
||||
LOCAL_PROGUARD_ENABLED := disabled
|
||||
|
||||
include $(BUILD_PACKAGE)
|
||||
|
|
|
@ -17,7 +17,4 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:sharedUserId="android.uid.system"
|
||||
package="org.lineageos.settings.device">
|
||||
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
|
||||
</manifest>
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2019 The LineageOS 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.
|
||||
-->
|
||||
<resources>
|
||||
<string name="motor_press_title">Warning</string>
|
||||
<string name="motor_press_message">Pressing down the front-facing camera can cause damages to the motor. Please avoid doing so.</string>
|
||||
<string name="motor_press_ok">Ok</string>
|
||||
</resources>
|
|
@ -16,17 +16,10 @@
|
|||
|
||||
package org.lineageos.settings.device;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Vibrator;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.android.internal.os.DeviceKeyHandler;
|
||||
|
||||
|
@ -38,9 +31,6 @@ public class KeyHandler implements DeviceKeyHandler {
|
|||
private static final int MODE_VIBRATION = 602;
|
||||
private static final int MODE_SILENCE = 603;
|
||||
|
||||
// Camera motor press sensor key codes
|
||||
private static final int KEY_F14 = 0x00b8;
|
||||
|
||||
private final Context mContext;
|
||||
private final AudioManager mAudioManager;
|
||||
private final Vibrator mVibrator;
|
||||
|
@ -65,13 +55,6 @@ public class KeyHandler implements DeviceKeyHandler {
|
|||
case MODE_SILENCE:
|
||||
mAudioManager.setRingerModeInternal(AudioManager.RINGER_MODE_SILENT);
|
||||
break;
|
||||
case KEY_F14:
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
new Handler(Looper.getMainLooper()).post(() -> {
|
||||
showCameraMotorPressWarning();
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return event;
|
||||
}
|
||||
|
@ -87,35 +70,4 @@ public class KeyHandler implements DeviceKeyHandler {
|
|||
|
||||
mVibrator.vibrate(50);
|
||||
}
|
||||
|
||||
/*
|
||||
* On OnePlus 7 Pro, alert the user to avoid pressing down the
|
||||
* front-facing camera manually.
|
||||
*/
|
||||
private void showCameraMotorPressWarning() {
|
||||
// Go back to home to close all camera apps first
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.addCategory(Intent.CATEGORY_HOME);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(intent);
|
||||
|
||||
// Show the alert
|
||||
Context packageContext;
|
||||
try {
|
||||
packageContext = mContext.createPackageContext("org.lineageos.settings.device", 0);
|
||||
} catch (PackageManager.NameNotFoundException | SecurityException e) {
|
||||
Log.e(TAG, Log.getStackTraceString(e));
|
||||
return;
|
||||
}
|
||||
AlertDialog dialog = new AlertDialog.Builder(packageContext)
|
||||
.setTitle(R.string.motor_press_title)
|
||||
.setMessage(R.string.motor_press_message)
|
||||
.setPositiveButton(R.string.motor_press_ok, (diag, which) -> {
|
||||
diag.dismiss();
|
||||
})
|
||||
.create();
|
||||
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
|
||||
dialog.setCanceledOnTouchOutside(false);
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue