Compare commits
201 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a8e756f058 | |||
|
|
2aa14e5ac1 | ||
| a9e2434135 | |||
|
|
da7c6b9c7e | ||
|
|
8cb6a428b8 | ||
|
|
45fd68a691 | ||
|
|
b3debd299e | ||
|
|
3db4e37b15 | ||
|
|
d4ba636d79 | ||
|
|
b5f8313c8b | ||
|
|
4c7541801e | ||
|
|
3b46301002 | ||
|
|
4e0edb8439 | ||
|
|
8410207b70 | ||
|
|
6935b56b10 | ||
|
|
2e28ec3b3b | ||
|
|
d55ca3f36a | ||
|
|
677728e777 | ||
|
|
f35cc8024f | ||
|
|
b438c19749 | ||
|
|
36147f24ae | ||
|
|
318cf2d6ff | ||
|
|
d46d0988b8 | ||
|
|
fef9704087 | ||
|
|
2e27e3c870 | ||
|
|
288abfe34e | ||
|
|
d54bc9bfed | ||
|
|
476c579574 | ||
|
|
b11f1f6140 | ||
|
|
60e2c0d181 | ||
|
|
f5c7563592 | ||
|
|
134a96902f | ||
|
|
42d234e7b1 | ||
|
|
ff08d01f05 | ||
|
|
881b81c5c2 | ||
|
|
a4c3063285 | ||
|
|
3909e55d4b | ||
|
|
e66bd88a16 | ||
|
|
ba41fe2135 | ||
|
|
8cb1749612 | ||
|
|
84b4fe25ff | ||
|
|
3661ded51c | ||
|
|
1d14ee1e5f | ||
|
|
28eb866b92 | ||
|
|
dc5ca02c7f | ||
|
|
5afdf4ec66 | ||
|
|
4dc9d516ba | ||
|
|
0244760a19 | ||
|
|
885b44b3d9 | ||
|
|
f29feffced | ||
|
|
047a6d40c8 | ||
|
|
4d5ed80495 | ||
|
|
08ee047103 | ||
|
|
7a12b4421b | ||
|
|
544a7ca610 | ||
|
|
1beec6d6f3 | ||
|
|
c1c47ac781 | ||
|
|
64ebb13708 | ||
|
|
1bfa52f911 | ||
|
|
654834e74b | ||
|
|
ee7cba88ee | ||
|
|
621fafd73b | ||
|
|
9cb7b80752 | ||
|
|
b44d204d85 | ||
|
|
80718930bd | ||
|
|
0260b93f2b | ||
|
|
2da53565a3 | ||
|
|
4e09fa357f | ||
|
|
6018e025c7 | ||
|
|
7a26bb680c | ||
|
|
af8b5b2101 | ||
|
|
0d49bb00a4 | ||
|
|
e43e0de28e | ||
|
|
b0ef79cd22 | ||
|
|
596af28122 | ||
|
|
d83a84ebb1 | ||
|
|
c6a79c52fd | ||
|
|
4cc3e7943e | ||
|
|
7f38220274 | ||
|
|
91c90c1342 | ||
|
|
ad122eac26 | ||
|
|
40be66bfb5 | ||
|
|
2c50925ba0 | ||
|
|
e62303931d | ||
|
|
69680e9415 | ||
|
|
92ebe070ab | ||
|
|
e7b724bcdd | ||
|
|
3cfc3da1fb | ||
|
|
f6b76fd2b1 | ||
|
|
d06ec4e02d | ||
|
|
3e1566fc71 | ||
|
|
23ce8c26e0 | ||
|
|
0dc562da5b | ||
|
|
89c44a7134 | ||
|
|
67826581ba | ||
|
|
da408f0fae | ||
|
|
221a68029a | ||
|
|
5cb4faad74 | ||
|
|
b680eae9a3 | ||
|
|
ecae06e225 | ||
|
|
dae91ed770 | ||
|
|
975e175c8c | ||
|
|
b7529516af | ||
|
|
f7e54b5bb7 | ||
|
|
02cdcb3595 | ||
|
|
4787b5111f | ||
|
|
c2ac80b26e | ||
|
|
d42835de19 | ||
|
|
0ec5c7ee17 | ||
|
|
8cbc195c1c | ||
|
|
34bdc76ed5 | ||
|
|
dc68150e61 | ||
|
|
11a489b80b | ||
|
|
ea27d5578c | ||
|
|
2c2c666e79 | ||
|
|
0841cef5b7 | ||
|
|
70c27d3906 | ||
|
|
dda94bb591 | ||
|
|
cf4c32a0d2 | ||
|
|
7e77774f6d | ||
|
|
85030c32bc | ||
|
|
efcb0981b3 | ||
|
|
d219e9dab7 | ||
|
|
d72f26d697 | ||
|
|
30af5429c8 | ||
|
|
00bdb4360e | ||
|
|
b7f4ffe60f | ||
|
|
bf6353c94d | ||
|
|
9e1ddd8dff | ||
|
|
3ab7d3e54c | ||
|
|
1a5f653c9a | ||
|
|
3205e0b0f3 | ||
|
|
7192398f65 | ||
|
|
0b4cc238ab | ||
|
|
128d956db2 | ||
|
|
394aa2e793 | ||
|
|
14f7c432cb | ||
|
|
af5a26eb25 | ||
|
|
3f4a69a1dd | ||
|
|
f8ec485a1c | ||
|
|
8a602bf650 | ||
|
|
f90a565d15 | ||
|
|
1b685157fa | ||
|
|
77bf539b3b | ||
|
|
98429e3f13 | ||
|
|
f0a0026ed3 | ||
|
|
55e999831a | ||
|
|
ff1be84372 | ||
|
|
c5ae56b117 | ||
|
|
753f235c4a | ||
|
|
3bac36d457 | ||
|
|
a049bb7efd | ||
|
|
d4f9134f96 | ||
|
|
1ff60bfff0 | ||
|
|
859abb5626 | ||
|
|
05e3cba485 | ||
|
|
dba2aef92a | ||
|
|
15e343047f | ||
|
|
9f813549e9 | ||
|
|
d7b9c4c999 | ||
|
|
31a56b12f8 | ||
|
|
efa692f969 | ||
|
|
bb9a27add9 | ||
|
|
e4aec89ee9 | ||
|
|
526648fcf6 | ||
|
|
f1003ce752 | ||
|
|
3dedf9c959 | ||
|
|
9d4c72dc99 | ||
|
|
234c545bec | ||
|
|
e2162b65ed | ||
|
|
cbe70f6a98 | ||
|
|
d72e165e4f | ||
|
|
8d5d48166e | ||
|
|
ff7dfce91f | ||
|
|
01ac349af0 | ||
|
|
1a4ac49ba1 | ||
|
|
05339ef6d9 | ||
|
|
823b03ee9c | ||
|
|
b22e76db0f | ||
|
|
0782313698 | ||
|
|
a1e3f9b235 | ||
|
|
41973058e6 | ||
|
|
325c2ff0ef | ||
|
|
24045995ae | ||
|
|
62a590a3e0 | ||
|
|
0ce9e4d22e | ||
|
|
2321cf482d | ||
|
|
f565d7e6c2 | ||
|
|
14f773f0bc | ||
|
|
1998146e2f | ||
|
|
3dff3e1051 | ||
|
|
df2b12b0e2 | ||
|
|
a91b970b30 | ||
|
|
11a12b9fdd | ||
|
|
86ea694955 | ||
|
|
176876bce6 | ||
|
|
8552508a5f | ||
|
|
9695a5684a | ||
|
|
c976840bcd | ||
|
|
5768223b50 | ||
|
|
b28da47d8b |
@@ -1 +0,0 @@
|
||||
../../build/soong/scripts/system-clang-format
|
||||
13
.clang-format
Normal file
13
.clang-format
Normal file
@@ -0,0 +1,13 @@
|
||||
BasedOnStyle: Google
|
||||
Standard: Cpp11
|
||||
AccessModifierOffset: -2
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
ColumnLimit: 100
|
||||
CommentPragmas: NOLINT:.*
|
||||
DerivePointerAlignment: false
|
||||
IncludeBlocks: Preserve
|
||||
IndentWidth: 4
|
||||
ContinuationIndentWidth: 8
|
||||
PointerAlignment: Left
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
13
.github/workflows/build/action.yml
vendored
Normal file
13
.github/workflows/build/action.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
name: build
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: pip install pre-commit
|
||||
|
||||
- name: Lint
|
||||
shell: bash
|
||||
run: pre-commit run --all
|
||||
38
.github/workflows/gerrit.yml
vendored
Normal file
38
.github/workflows/gerrit.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
name: gerrit checks
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
ref:
|
||||
type: string
|
||||
gerrit-ref:
|
||||
type: string
|
||||
change:
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: lineageos-infra/fetch-gerrit-change@main
|
||||
with:
|
||||
gerrit-ref: ${{ inputs.gerrit-ref }}
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
- name: Check if build/action.yml exists
|
||||
id: check
|
||||
run: |
|
||||
if [ -f ./.github/workflows/build/action.yml ]; then
|
||||
echo "run=1" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Build
|
||||
if: ${{ steps.check.outputs.run }}
|
||||
uses: ./.github/workflows/build
|
||||
|
||||
- uses: lineageos-infra/gerrit-vote@main
|
||||
if: ${{ steps.check.outputs.run && always() }}
|
||||
with:
|
||||
auth: ${{ secrets.GERRIT_VOTE_CREDS }}
|
||||
change: ${{ inputs.change }}
|
||||
ref: ${{ inputs.ref }}
|
||||
20
.pre-commit-config.yaml
Normal file
20
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v6.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-added-large-files
|
||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||
rev: v21.1.8
|
||||
hooks:
|
||||
- id: clang-format
|
||||
types_or: [c, c++]
|
||||
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
|
||||
rev: v2.15.0
|
||||
hooks:
|
||||
- id: pretty-format-kotlin
|
||||
args: [--autofix, --ktfmt, --ktfmt-style=kotlinlang]
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// SPDX-FileCopyrightText: 2022-2025 The LineageOS Project
|
||||
// SPDX-FileCopyrightText: 2022-2026 The LineageOS Project
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -23,3 +23,10 @@ prebuilt_hidl_interfaces {
|
||||
"vendor.pixelworks.hardware.feature@1.0::IIrisFeature",
|
||||
],
|
||||
}
|
||||
|
||||
prebuilt_hidl_interfaces {
|
||||
name: "hidl_zeku_explorer_interface",
|
||||
interfaces: [
|
||||
"vendor.zeku.hardware.explorer@1.0::IMmsProvider",
|
||||
],
|
||||
}
|
||||
|
||||
@@ -1,32 +1,17 @@
|
||||
//
|
||||
// Copyright (C) 2023-2025 The LineageOS Project
|
||||
//
|
||||
// SPDX-FileCopyrightText: 2023-2025 The LineageOS Project
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
android_app {
|
||||
phony {
|
||||
name: "OplusEuicc",
|
||||
|
||||
srcs: ["src/**/*.kt"],
|
||||
|
||||
sdk_version: "current",
|
||||
product_specific: true,
|
||||
certificate: "platform",
|
||||
privileged: true,
|
||||
privapp_allowlist: "org.lineageos.euicc.xml",
|
||||
|
||||
optimize: {
|
||||
proguard_flags_files: ["proguard.flags"],
|
||||
},
|
||||
required: [
|
||||
"hidden-api-whitelist-org.lineageos.euicc.xml",
|
||||
"EuiccPolicy",
|
||||
"EuiccPolicyOplus",
|
||||
],
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "hidden-api-whitelist-org.lineageos.euicc.xml",
|
||||
relative_install_path: "sysconfig",
|
||||
filename: "hidden-api-whitelist-org.lineageos.euicc.xml",
|
||||
src: "hidden-api-whitelist-org.lineageos.euicc.xml",
|
||||
runtime_resource_overlay {
|
||||
name: "EuiccPolicyOplus",
|
||||
product_specific: true,
|
||||
}
|
||||
|
||||
@@ -1,42 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023-2024 The LineageOS Project
|
||||
SPDX-FileCopyrightText: 2023-2025 The LineageOS Project
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.lineageos.euicc">
|
||||
|
||||
<queries>
|
||||
<package android:name="com.google.android.gms" />
|
||||
<package android:name="com.google.android.gsf" />
|
||||
<package android:name="com.google.android.euicc" />
|
||||
<package android:name="com.google.android.ims" />
|
||||
</queries>
|
||||
|
||||
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS" />
|
||||
|
||||
<application
|
||||
android:persistent="true"
|
||||
android:usesNonSdkApi="true">
|
||||
<receiver
|
||||
android:exported="true"
|
||||
android:name=".BootCompletedReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver
|
||||
android:directBootAware="true"
|
||||
android:exported="true"
|
||||
android:name=".EuiccReceiver"
|
||||
android:permission="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.euicc.action.PARTNER_CUSTOMIZATION"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
package="org.lineageos.euicc.overlay.oplus">
|
||||
<overlay android:targetPackage="org.lineageos.euicc"
|
||||
android:isStatic="true" />
|
||||
</manifest>
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<config>
|
||||
<hidden-api-whitelisted-app package="org.lineageos.euicc" />
|
||||
</config>
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<permissions>
|
||||
<privapp-permissions package="org.lineageos.euicc">
|
||||
<permission name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"/>
|
||||
<permission name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"/>
|
||||
</privapp-permissions>
|
||||
</permissions>
|
||||
@@ -1,3 +0,0 @@
|
||||
-keep class org.lineageos.euicc.* {
|
||||
*;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -15,7 +15,9 @@
|
||||
\"OP595DL1\",
|
||||
\"OP5CF9L1\",
|
||||
\"OP5D0DL1\",
|
||||
\"OP5D2BL1\",
|
||||
\"OP5D35L1\",
|
||||
\"OP5D3BL1\",
|
||||
\"OP5D55L1\"
|
||||
],
|
||||
\"illustration_lottie\": \"sim_illustration_lottie_bottom\"
|
||||
@@ -31,6 +33,7 @@
|
||||
\"OP594DL1\",
|
||||
\"OP595DL1\",
|
||||
\"OP5D35L1\",
|
||||
\"OP5D3BL1\",
|
||||
\"OP5D55L1\"
|
||||
],
|
||||
\"esim-slot-ids\": [
|
||||
@@ -45,7 +48,8 @@
|
||||
\"OP591BL1\",
|
||||
\"OP5929L1\",
|
||||
\"OP5CF9L1\",
|
||||
\"OP5D0DL1\"
|
||||
\"OP5D0DL1\",
|
||||
\"OP5D2BL1\"
|
||||
],
|
||||
\"esim-slot-ids\": [],
|
||||
\"psim-slot-ids\": [
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.lineageos.euicc
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
|
||||
class BootCompletedReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
Log.d(TAG, "Received boot completed intent")
|
||||
EuiccDisabler.enableOrDisableEuicc(context)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "OplusEuiccBootReceiver"
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2024 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.lineageos.euicc
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.pm.PackageManager.ApplicationInfoFlags
|
||||
import android.util.Log
|
||||
|
||||
object EuiccDisabler {
|
||||
private const val TAG = "OplusEuiccDisabler"
|
||||
|
||||
private val EUICC_DEPENDENCIES = listOf(
|
||||
"com.google.android.gms",
|
||||
"com.google.android.gsf",
|
||||
)
|
||||
|
||||
private val EUICC_PACKAGES = listOf(
|
||||
"com.google.android.euicc",
|
||||
"com.google.android.ims",
|
||||
)
|
||||
|
||||
private fun isInstalled(pm: PackageManager, pkgName: String) = runCatching {
|
||||
val info = pm.getApplicationInfo(pkgName, ApplicationInfoFlags.of(0))
|
||||
info.flags and ApplicationInfo.FLAG_INSTALLED != 0
|
||||
}.getOrDefault(false)
|
||||
|
||||
private fun isInstalledAndEnabled(pm: PackageManager, pkgName: String) = runCatching {
|
||||
val info = pm.getApplicationInfo(pkgName, ApplicationInfoFlags.of(0))
|
||||
Log.d(TAG, "package $pkgName installed, enabled = ${info.enabled}")
|
||||
info.enabled
|
||||
}.getOrDefault(false)
|
||||
|
||||
fun enableOrDisableEuicc(context: Context) {
|
||||
val pm = context.packageManager
|
||||
val disable = EUICC_DEPENDENCIES.any { !isInstalledAndEnabled(pm, it) }
|
||||
val flag = if (disable) {
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED
|
||||
} else {
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED
|
||||
}
|
||||
|
||||
for (pkg in EUICC_PACKAGES) {
|
||||
if (isInstalled(pm, pkg)) {
|
||||
pm.setApplicationEnabledSetting(pkg, flag, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2023 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.lineageos.euicc
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
|
||||
class EuiccReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
Log.d(TAG, "Received PARTNER_CUSTOMIZATION intent")
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "OplusEuiccReceiver"
|
||||
}
|
||||
}
|
||||
@@ -22,113 +22,131 @@ import vendor.oplus.hardware.biometrics.fingerprintpay.IFingerprintPay
|
||||
class IfaaService : Service() {
|
||||
private var _fpPayService: IFingerprintPay? = null
|
||||
|
||||
private val fpPayServiceDeathRecipient = IBinder.DeathRecipient {
|
||||
Log.i(LOG_TAG, "aidl FingerprintPay hal died, reset hal proxy!")
|
||||
_fpPayService = null
|
||||
}
|
||||
private val fpPayServiceDeathRecipient =
|
||||
IBinder.DeathRecipient {
|
||||
Log.i(LOG_TAG, "aidl FingerprintPay hal died, reset hal proxy!")
|
||||
_fpPayService = null
|
||||
}
|
||||
|
||||
private val fingerprintManager by lazy { getSystemService(FingerprintManager::class.java)!! }
|
||||
private val keyguardManager by lazy { getSystemService(KeyguardManager::class.java)!! }
|
||||
private val windowManager by lazy { getSystemService(WindowManager::class.java)!! }
|
||||
|
||||
override fun onBind(intent: Intent) = object : IfaaManagerService.Stub() {
|
||||
private val _supportBIOTypes by lazy {
|
||||
when (SystemProperties.get(FP_TYPE_PROP, "")) {
|
||||
"back", "side", "front" -> AUTH_TYPE_FINGERPRINT
|
||||
"ultrasonic", "optical" -> AUTH_TYPE_OPTICAL_FINGERPRINT
|
||||
else -> AUTH_TYPE_NOT_SUPPORT
|
||||
}
|
||||
}
|
||||
|
||||
override fun getSupportBIOTypes() = _supportBIOTypes
|
||||
|
||||
override fun startBIOManager(authType: Int) = when (authType) {
|
||||
AUTH_TYPE_FINGERPRINT -> {
|
||||
applicationContext.startActivity(
|
||||
Intent(Settings.ACTION_SECURITY_SETTINGS).apply {
|
||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
}
|
||||
)
|
||||
|
||||
COMMAND_OK
|
||||
override fun onBind(intent: Intent) =
|
||||
object : IfaaManagerService.Stub() {
|
||||
private val _supportBIOTypes by lazy {
|
||||
when (SystemProperties.get(FP_TYPE_PROP, "")) {
|
||||
"back",
|
||||
"side",
|
||||
"front" -> AUTH_TYPE_FINGERPRINT
|
||||
"ultrasonic",
|
||||
"optical" -> AUTH_TYPE_OPTICAL_FINGERPRINT
|
||||
else -> AUTH_TYPE_NOT_SUPPORT
|
||||
}
|
||||
}
|
||||
|
||||
else -> COMMAND_FAIL
|
||||
}
|
||||
override fun getSupportBIOTypes() = _supportBIOTypes
|
||||
|
||||
private val _deviceModel by lazy { SystemProperties.get(IFAA_MODEL_PROP, "OPLUS-Default") }
|
||||
override fun getDeviceModel() = _deviceModel
|
||||
override fun startBIOManager(authType: Int) =
|
||||
when (authType) {
|
||||
AUTH_TYPE_FINGERPRINT -> {
|
||||
applicationContext.startActivity(
|
||||
Intent(Settings.ACTION_SECURITY_SETTINGS).apply {
|
||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
}
|
||||
)
|
||||
|
||||
override fun processCmd(param: ByteArray) = try {
|
||||
getFpPayService()?.ifaa_invoke_command(param)
|
||||
} catch (e: Exception) {
|
||||
Log.e(LOG_TAG, "processCmdImpl: ifaa_invoke_command aidl failed", e)
|
||||
null
|
||||
}
|
||||
|
||||
override fun getVersion() = 4
|
||||
|
||||
override fun getExtInfo(authType: Int, keyExtInfo: String) = when (keyExtInfo) {
|
||||
KEY_GET_SENSOR_LOCATION -> initExtString()
|
||||
else -> ""
|
||||
}
|
||||
|
||||
override fun setExtInfo(authType: Int, keyExtInfo: String, valExtInfo: String) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
override fun getEnabled(bioType: Int): Int {
|
||||
if (!keyguardManager.isKeyguardSecure) {
|
||||
Log.e(LOG_TAG, "No secure keyguard set.")
|
||||
return BIOMETRIC_NOUSE_NOSET_KEYGUARD
|
||||
}
|
||||
|
||||
return when (bioType) {
|
||||
AUTH_TYPE_FINGERPRINT -> when {
|
||||
!fingerprintManager.isHardwareDetected -> {
|
||||
Log.e(LOG_TAG, "Fingerprint hardware not available!")
|
||||
BIOMETRIC_NOUSE_SYSTEMLOCKED
|
||||
COMMAND_OK
|
||||
}
|
||||
|
||||
fingerprintManager.enrolledFingerprints.isNullOrEmpty() -> {
|
||||
Log.e(LOG_TAG, "Fingerprint not enrolled!")
|
||||
BIOMETRIC_NOUSE_NOT_ENROLLED
|
||||
}
|
||||
|
||||
else -> BIOMETRIC_USE_READY
|
||||
else -> COMMAND_FAIL
|
||||
}
|
||||
|
||||
else -> 0
|
||||
}
|
||||
}
|
||||
|
||||
override fun getIDList(bioType: Int): IntArray? = when (bioType) {
|
||||
AUTH_TYPE_FINGERPRINT -> {
|
||||
val enrolledFingerprintIds = fingerprintManager.enrolledFingerprints?.map {
|
||||
it.biometricId
|
||||
}?.toIntArray()
|
||||
|
||||
Log.w(LOG_TAG, "getIDList: ${enrolledFingerprintIds}!")
|
||||
enrolledFingerprintIds
|
||||
private val _deviceModel by lazy {
|
||||
SystemProperties.get(IFAA_MODEL_PROP, "OPLUS-Default")
|
||||
}
|
||||
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
override fun getDeviceModel() = _deviceModel
|
||||
|
||||
private fun getFpPayService() = _fpPayService ?: run {
|
||||
val binder = ServiceManager.getService("${IFingerprintPay.DESCRIPTOR}/default")
|
||||
IFingerprintPay.Stub.asInterface(binder)?.also {
|
||||
binder.linkToDeath(fpPayServiceDeathRecipient, 0)
|
||||
_fpPayService = it
|
||||
override fun processCmd(param: ByteArray) =
|
||||
try {
|
||||
getFpPayService()?.ifaa_invoke_command(param)
|
||||
} catch (e: Exception) {
|
||||
Log.e(LOG_TAG, "processCmdImpl: ifaa_invoke_command aidl failed", e)
|
||||
null
|
||||
}
|
||||
|
||||
override fun getVersion() = 4
|
||||
|
||||
override fun getExtInfo(authType: Int, keyExtInfo: String) =
|
||||
when (keyExtInfo) {
|
||||
KEY_GET_SENSOR_LOCATION -> initExtString()
|
||||
else -> ""
|
||||
}
|
||||
|
||||
override fun setExtInfo(authType: Int, keyExtInfo: String, valExtInfo: String) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
override fun getEnabled(bioType: Int): Int {
|
||||
if (!keyguardManager.isKeyguardSecure) {
|
||||
Log.e(LOG_TAG, "No secure keyguard set.")
|
||||
return BIOMETRIC_NOUSE_NOSET_KEYGUARD
|
||||
}
|
||||
|
||||
return when (bioType) {
|
||||
AUTH_TYPE_FINGERPRINT ->
|
||||
when {
|
||||
!fingerprintManager.isHardwareDetected -> {
|
||||
Log.e(LOG_TAG, "Fingerprint hardware not available!")
|
||||
BIOMETRIC_NOUSE_SYSTEMLOCKED
|
||||
}
|
||||
|
||||
fingerprintManager.enrolledFingerprints.isNullOrEmpty() -> {
|
||||
Log.e(LOG_TAG, "Fingerprint not enrolled!")
|
||||
BIOMETRIC_NOUSE_NOT_ENROLLED
|
||||
}
|
||||
|
||||
else -> BIOMETRIC_USE_READY
|
||||
}
|
||||
|
||||
else -> 0
|
||||
}
|
||||
}
|
||||
|
||||
override fun getIDList(bioType: Int): IntArray? =
|
||||
when (bioType) {
|
||||
AUTH_TYPE_FINGERPRINT -> {
|
||||
val enrolledFingerprintIds =
|
||||
fingerprintManager.enrolledFingerprints
|
||||
?.map { it.biometricId }
|
||||
?.toIntArray()
|
||||
|
||||
Log.w(LOG_TAG, "getIDList: ${enrolledFingerprintIds}!")
|
||||
enrolledFingerprintIds
|
||||
}
|
||||
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getFpPayService() =
|
||||
_fpPayService
|
||||
?: run {
|
||||
val binder = ServiceManager.getService("${IFingerprintPay.DESCRIPTOR}/default")
|
||||
IFingerprintPay.Stub.asInterface(binder)?.also {
|
||||
binder.linkToDeath(fpPayServiceDeathRecipient, 0)
|
||||
_fpPayService = it
|
||||
}
|
||||
}
|
||||
|
||||
private val defaultDisplayDimension by lazy {
|
||||
val dim1 = displayNoVerify?.supportedModes?.maxByOrNull { it.physicalHeight }
|
||||
?.run { Point(physicalWidth, physicalHeight) }
|
||||
val dim2 = windowManager.maximumWindowMetrics.bounds
|
||||
.run { Point(width(), height()) }
|
||||
val dim1 =
|
||||
displayNoVerify
|
||||
?.supportedModes
|
||||
?.maxByOrNull { it.physicalHeight }
|
||||
?.run { Point(physicalWidth, physicalHeight) }
|
||||
val dim2 = windowManager.maximumWindowMetrics.bounds.run { Point(width(), height()) }
|
||||
|
||||
dim1?.let { Point(maxOf(dim1.x, dim2.x), maxOf(dim1.y, dim2.y)) } ?: dim2
|
||||
}
|
||||
@@ -140,33 +158,37 @@ class IfaaService : Service() {
|
||||
val iconLocationBottom = SystemProperties.getInt(FP_ICON_LOCATION_PROP, 278)
|
||||
Point(
|
||||
(defaultDisplayDimension.x - iconDiameter) / 2,
|
||||
defaultDisplayDimension.y - iconLocationBottom - iconDiameter / 2
|
||||
defaultDisplayDimension.y - iconLocationBottom - iconDiameter / 2,
|
||||
)
|
||||
}
|
||||
|
||||
private fun initExtString() = run {
|
||||
val displayDimension = windowManager.maximumWindowMetrics.bounds.run {
|
||||
Point(width(), height())
|
||||
}
|
||||
val displayDimension =
|
||||
windowManager.maximumWindowMetrics.bounds.run { Point(width(), height()) }
|
||||
val scale = { pos: Point ->
|
||||
Point(
|
||||
pos.x * displayDimension.x / defaultDisplayDimension.x,
|
||||
pos.y * displayDimension.y / defaultDisplayDimension.y
|
||||
pos.y * displayDimension.y / defaultDisplayDimension.y,
|
||||
)
|
||||
}
|
||||
val scaledLocation = scale(iconLocation)
|
||||
val scaledDiameter = scale(Point(iconDiameter, iconDiameter))
|
||||
|
||||
JSONObject().apply {
|
||||
put("type", 0)
|
||||
put("fullView", JSONObject().apply {
|
||||
put("startX", scaledLocation.x)
|
||||
put("startY", scaledLocation.y)
|
||||
put("width", scaledDiameter.x)
|
||||
put("height", scaledDiameter.y)
|
||||
put("navConflict", true)
|
||||
})
|
||||
}.toString()
|
||||
JSONObject()
|
||||
.apply {
|
||||
put("type", 0)
|
||||
put(
|
||||
"fullView",
|
||||
JSONObject().apply {
|
||||
put("startX", scaledLocation.x)
|
||||
put("startY", scaledLocation.y)
|
||||
put("width", scaledDiameter.x)
|
||||
put("height", scaledDiameter.y)
|
||||
put("navConflict", true)
|
||||
},
|
||||
)
|
||||
}
|
||||
.toString()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -12,7 +12,9 @@ android_app {
|
||||
],
|
||||
|
||||
optimize: {
|
||||
optimize: true,
|
||||
proguard_flags_files: ["proguard.flags"],
|
||||
shrink_resources: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
19
KeyHandler/res/values-sc-rIT/strings.xml
Normal file
19
KeyHandler/res/values-sc-rIT/strings.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2021 The LineageOS Project
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<resources>
|
||||
<string name="alert_slider_selection_dialog_title">Atzione</string>
|
||||
<string name="alert_slider_top_position">Positzione superiore</string>
|
||||
<string name="alert_slider_middle_position">Positzione tzentrale</string>
|
||||
<string name="alert_slider_bottom_position">Positzione inferiore</string>
|
||||
<string name="alert_slider_mode_silent">A sa muda</string>
|
||||
<string name="alert_slider_mode_normal">Normale</string>
|
||||
<string name="alert_slider_mode_vibration">Vibratzione</string>
|
||||
<string name="alert_slider_mode_dnd_priority_only">Prioridade isceti</string>
|
||||
<string name="alert_slider_mode_dnd_total_silence">Silèntziu totale</string>
|
||||
<string name="alert_slider_mode_dnd_alarms_only">Isvèllias isceti</string>
|
||||
<string name="alert_slider_mute_media_title">Pone is cuntenutos multimediales a sa muda</string>
|
||||
<string name="alert_slider_mute_media_summary">Pone is cuntenutos multimediales a sa muda cando passas a silèntziu</string>
|
||||
</resources>
|
||||
@@ -3,7 +3,10 @@
|
||||
SPDX-FileCopyrightText: 2021-2025 The LineageOS Project
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/alert_slider_category_title">
|
||||
|
||||
@@ -16,29 +19,29 @@
|
||||
<ListPreference
|
||||
android:key="config_top_position"
|
||||
android:dialogTitle="@string/alert_slider_selection_dialog_title"
|
||||
android:title="@string/alert_slider_top_position"
|
||||
android:summary="%s"
|
||||
android:entries="@array/alert_slider_action_entries"
|
||||
android:entryValues="@array/alert_slider_action_entry_values"
|
||||
android:defaultValue="0" />
|
||||
android:defaultValue="0"
|
||||
android:title="@string/alert_slider_top_position"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<ListPreference
|
||||
android:key="config_middle_position"
|
||||
android:dialogTitle="@string/alert_slider_selection_dialog_title"
|
||||
android:title="@string/alert_slider_middle_position"
|
||||
android:summary="%s"
|
||||
android:entries="@array/alert_slider_action_entries"
|
||||
android:entryValues="@array/alert_slider_action_entry_values"
|
||||
android:defaultValue="1" />
|
||||
android:defaultValue="1"
|
||||
android:title="@string/alert_slider_middle_position"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<ListPreference
|
||||
android:key="config_bottom_position"
|
||||
android:dialogTitle="@string/alert_slider_selection_dialog_title"
|
||||
android:title="@string/alert_slider_bottom_position"
|
||||
android:summary="%s"
|
||||
android:entries="@array/alert_slider_action_entries"
|
||||
android:entryValues="@array/alert_slider_action_entry_values"
|
||||
android:defaultValue="2" />
|
||||
android:defaultValue="2"
|
||||
android:title="@string/alert_slider_bottom_position"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
||||
@@ -16,8 +16,9 @@ class ButtonSettingsActivity : CollapsingToolbarBaseActivity() {
|
||||
.replace(
|
||||
com.android.settingslib.collapsingtoolbar.R.id.content_frame,
|
||||
ButtonSettingsFragment(),
|
||||
TAG
|
||||
).commit()
|
||||
TAG,
|
||||
)
|
||||
.commit()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -8,7 +8,6 @@ package org.lineageos.settings.device
|
||||
import android.database.Cursor
|
||||
import android.database.MatrixCursor
|
||||
import android.provider.SearchIndexableResource
|
||||
import android.provider.SearchIndexablesProvider
|
||||
import android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_CLASS_NAME
|
||||
import android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_ICON_RESID
|
||||
import android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_INTENT_ACTION
|
||||
@@ -19,15 +18,14 @@ import android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_RESID
|
||||
import android.provider.SearchIndexablesContract.INDEXABLES_RAW_COLUMNS
|
||||
import android.provider.SearchIndexablesContract.INDEXABLES_XML_RES_COLUMNS
|
||||
import android.provider.SearchIndexablesContract.NON_INDEXABLES_KEYS_COLUMNS
|
||||
import android.provider.SearchIndexablesProvider
|
||||
|
||||
class ConfigPanelSearchIndexablesProvider : SearchIndexablesProvider() {
|
||||
override fun onCreate(): Boolean = true
|
||||
|
||||
override fun queryXmlResources(projection: Array<String?>?): Cursor {
|
||||
val cursor = MatrixCursor(INDEXABLES_XML_RES_COLUMNS)
|
||||
INDEXABLE_RES.forEach {
|
||||
cursor.addRow(generateResourceRef(it))
|
||||
}
|
||||
INDEXABLE_RES.forEach { cursor.addRow(generateResourceRef(it)) }
|
||||
return cursor
|
||||
}
|
||||
|
||||
@@ -54,10 +52,14 @@ class ConfigPanelSearchIndexablesProvider : SearchIndexablesProvider() {
|
||||
companion object {
|
||||
private const val TAG = "ConfigPanelSearchIndexablesProvider"
|
||||
|
||||
private val INDEXABLE_RES = arrayOf<SearchIndexableResource>(
|
||||
SearchIndexableResource(
|
||||
1, R.xml.button_panel, ButtonSettingsActivity::class.java.name, 0
|
||||
private val INDEXABLE_RES =
|
||||
arrayOf<SearchIndexableResource>(
|
||||
SearchIndexableResource(
|
||||
1,
|
||||
R.xml.button_panel,
|
||||
ButtonSettingsActivity::class.java.name,
|
||||
0,
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import android.os.Vibrator
|
||||
import android.provider.Settings
|
||||
import android.view.KeyEvent
|
||||
import com.android.internal.os.DeviceKeyHandler
|
||||
|
||||
import java.io.File
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
@@ -27,35 +26,35 @@ class KeyHandler(context: Context) : DeviceKeyHandler {
|
||||
private val notificationManager = context.getSystemService(NotificationManager::class.java)!!
|
||||
private val vibrator = context.getSystemService(Vibrator::class.java)!!
|
||||
|
||||
private val packageContext = context.createPackageContext(
|
||||
KeyHandler::class.java.getPackage()!!.name, 0
|
||||
)
|
||||
private val packageContext =
|
||||
context.createPackageContext(KeyHandler::class.java.getPackage()!!.name, 0)
|
||||
private val sharedPreferences
|
||||
get() = packageContext.getSharedPreferences(
|
||||
packageContext.packageName + "_preferences",
|
||||
Context.MODE_PRIVATE or Context.MODE_MULTI_PROCESS
|
||||
)
|
||||
get() =
|
||||
packageContext.getSharedPreferences(
|
||||
packageContext.packageName + "_preferences",
|
||||
Context.MODE_PRIVATE or Context.MODE_MULTI_PROCESS,
|
||||
)
|
||||
|
||||
private val executorService = Executors.newSingleThreadExecutor()
|
||||
|
||||
private var wasMuted = false
|
||||
private val broadcastReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
when (intent.action) {
|
||||
AudioManager.STREAM_MUTE_CHANGED_ACTION -> {
|
||||
val stream = intent.getIntExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, -1)
|
||||
val state = intent.getBooleanExtra(
|
||||
AudioManager.EXTRA_STREAM_VOLUME_MUTED, false
|
||||
)
|
||||
if (stream == AudioSystem.STREAM_MUSIC && !state) {
|
||||
wasMuted = false
|
||||
private val broadcastReceiver =
|
||||
object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
when (intent.action) {
|
||||
AudioManager.STREAM_MUTE_CHANGED_ACTION -> {
|
||||
val stream = intent.getIntExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, -1)
|
||||
val state =
|
||||
intent.getBooleanExtra(AudioManager.EXTRA_STREAM_VOLUME_MUTED, false)
|
||||
if (stream == AudioSystem.STREAM_MUSIC && !state) {
|
||||
wasMuted = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Intent.ACTION_BOOT_COMPLETED -> populateKeyState(false)
|
||||
Intent.ACTION_BOOT_COMPLETED -> populateKeyState(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
context.registerReceiver(
|
||||
@@ -63,7 +62,7 @@ class KeyHandler(context: Context) : DeviceKeyHandler {
|
||||
IntentFilter().apply {
|
||||
addAction(AudioManager.STREAM_MUTE_CHANGED_ACTION)
|
||||
addAction(Intent.ACTION_BOOT_COMPLETED)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -93,26 +92,25 @@ class KeyHandler(context: Context) : DeviceKeyHandler {
|
||||
|
||||
private fun vibrateIfNeeded(mode: Int) {
|
||||
when (mode) {
|
||||
AudioManager.RINGER_MODE_VIBRATE -> vibrator.vibrate(
|
||||
MODE_VIBRATION_EFFECT,
|
||||
HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES
|
||||
)
|
||||
AudioManager.RINGER_MODE_NORMAL -> vibrator.vibrate(
|
||||
MODE_NORMAL_EFFECT,
|
||||
HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES
|
||||
)
|
||||
AudioManager.RINGER_MODE_VIBRATE ->
|
||||
vibrator.vibrate(MODE_VIBRATION_EFFECT, HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES)
|
||||
AudioManager.RINGER_MODE_NORMAL ->
|
||||
vibrator.vibrate(MODE_NORMAL_EFFECT, HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES)
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleMode(position: Int, vibrate: Boolean) {
|
||||
val muteMedia = sharedPreferences.getBoolean(MUTE_MEDIA_WITH_SILENT, false)
|
||||
|
||||
val mode = when (position) {
|
||||
POSITION_TOP -> sharedPreferences.getString(ALERT_SLIDER_TOP_KEY, "0")!!.toInt()
|
||||
POSITION_MIDDLE -> sharedPreferences.getString(ALERT_SLIDER_MIDDLE_KEY, "1")!!.toInt()
|
||||
POSITION_BOTTOM -> sharedPreferences.getString(ALERT_SLIDER_BOTTOM_KEY, "2")!!.toInt()
|
||||
else -> return
|
||||
}
|
||||
val mode =
|
||||
when (position) {
|
||||
POSITION_TOP -> sharedPreferences.getString(ALERT_SLIDER_TOP_KEY, "0")!!.toInt()
|
||||
POSITION_MIDDLE ->
|
||||
sharedPreferences.getString(ALERT_SLIDER_MIDDLE_KEY, "1")!!.toInt()
|
||||
POSITION_BOTTOM ->
|
||||
sharedPreferences.getString(ALERT_SLIDER_BOTTOM_KEY, "2")!!.toInt()
|
||||
else -> return
|
||||
}
|
||||
|
||||
executorService.submit {
|
||||
when (mode) {
|
||||
@@ -124,14 +122,17 @@ class KeyHandler(context: Context) : DeviceKeyHandler {
|
||||
wasMuted = true
|
||||
}
|
||||
}
|
||||
AudioManager.RINGER_MODE_VIBRATE, AudioManager.RINGER_MODE_NORMAL -> {
|
||||
AudioManager.RINGER_MODE_VIBRATE,
|
||||
AudioManager.RINGER_MODE_NORMAL -> {
|
||||
setZenMode(Settings.Global.ZEN_MODE_OFF)
|
||||
audioManager.ringerModeInternal = mode
|
||||
if (muteMedia && wasMuted) {
|
||||
audioManager.adjustVolume(AudioManager.ADJUST_UNMUTE, 0)
|
||||
}
|
||||
}
|
||||
ZEN_PRIORITY_ONLY, ZEN_TOTAL_SILENCE, ZEN_ALARMS_ONLY -> {
|
||||
ZEN_PRIORITY_ONLY,
|
||||
ZEN_TOTAL_SILENCE,
|
||||
ZEN_ALARMS_ONLY -> {
|
||||
audioManager.ringerModeInternal = AudioManager.RINGER_MODE_NORMAL
|
||||
setZenMode(mode - ZEN_OFFSET)
|
||||
if (muteMedia && wasMuted) {
|
||||
|
||||
9
Pen/res/values-sc-rIT/strings.xml
Normal file
9
Pen/res/values-sc-rIT/strings.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2025 The LineageOS Project
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<resources>
|
||||
<string name="pen_attached">Pinna alligongiada</string>
|
||||
<string name="tap_to_connect">Toca pro connètere</string>
|
||||
</resources>
|
||||
@@ -15,7 +15,6 @@ import android.bluetooth.le.ScanCallback
|
||||
import android.bluetooth.le.ScanFilter
|
||||
import android.bluetooth.le.ScanResult
|
||||
import android.bluetooth.le.ScanSettings
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.database.ContentObserver
|
||||
import android.hardware.input.InputManager
|
||||
@@ -31,41 +30,45 @@ class PenService : Service() {
|
||||
private val inputManager by lazy { getSystemService(InputManager::class.java) }
|
||||
private val notificationManager by lazy { getSystemService(NotificationManager::class.java) }
|
||||
|
||||
private val penSupportedRefreshRate by lazy { getString(R.string.config_penSupportedRefreshRate) }
|
||||
private val penSupportedRefreshRate by lazy {
|
||||
getString(R.string.config_penSupportedRefreshRate)
|
||||
}
|
||||
|
||||
private val handler by lazy { Handler(mainLooper) }
|
||||
|
||||
private val observer = object : UEventObserver() {
|
||||
private val lock = Any()
|
||||
private val observer =
|
||||
object : UEventObserver() {
|
||||
private val lock = Any()
|
||||
|
||||
override fun onUEvent(event: UEvent) {
|
||||
synchronized(lock) {
|
||||
val pencilStatus = event.get("pencil_status") ?: return
|
||||
val pencilAddr = event.get("pencil_addr")?.chunked(2)?.joinToString(":") {
|
||||
it.uppercase()
|
||||
} ?: return
|
||||
override fun onUEvent(event: UEvent) {
|
||||
synchronized(lock) {
|
||||
val pencilStatus = event.get("pencil_status") ?: return
|
||||
val pencilAddr =
|
||||
event.get("pencil_addr")?.chunked(2)?.joinToString(":") { it.uppercase() }
|
||||
?: return
|
||||
|
||||
when (pencilStatus) {
|
||||
"0" -> notificationManager.cancel(NOTIFICATION_ID)
|
||||
"1" -> postNotification(pencilAddr)
|
||||
when (pencilStatus) {
|
||||
"0" -> notificationManager.cancel(NOTIFICATION_ID)
|
||||
"1" -> postNotification(pencilAddr)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val inputObserver = object : InputManager.InputDeviceListener {
|
||||
override fun onInputDeviceAdded(deviceId: Int) {
|
||||
overridePeakRefreshRateIfNeeded()
|
||||
}
|
||||
private val inputObserver =
|
||||
object : InputManager.InputDeviceListener {
|
||||
override fun onInputDeviceAdded(deviceId: Int) {
|
||||
overridePeakRefreshRateIfNeeded()
|
||||
}
|
||||
|
||||
override fun onInputDeviceRemoved(deviceId: Int) {
|
||||
overridePeakRefreshRateIfNeeded()
|
||||
}
|
||||
override fun onInputDeviceRemoved(deviceId: Int) {
|
||||
overridePeakRefreshRateIfNeeded()
|
||||
}
|
||||
|
||||
override fun onInputDeviceChanged(deviceId: Int) {
|
||||
// Do nothing
|
||||
override fun onInputDeviceChanged(deviceId: Int) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val peakRefreshRateSettingsObserver by lazy {
|
||||
object : ContentObserver(handler) {
|
||||
@@ -78,9 +81,7 @@ class PenService : Service() {
|
||||
}
|
||||
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
intent?.getStringExtra(EXTRA_PENCIL_ADDR)?.let {
|
||||
bondBtDevice(it)
|
||||
}
|
||||
intent?.getStringExtra(EXTRA_PENCIL_ADDR)?.let { bondBtDevice(it) }
|
||||
|
||||
return START_STICKY
|
||||
}
|
||||
@@ -94,7 +95,7 @@ class PenService : Service() {
|
||||
contentResolver.registerContentObserver(
|
||||
Settings.System.getUriFor(PEAK_REFRESH_RATE),
|
||||
false,
|
||||
peakRefreshRateSettingsObserver
|
||||
peakRefreshRateSettingsObserver,
|
||||
)
|
||||
peakRefreshRateSettingsObserver.onChange(true)
|
||||
|
||||
@@ -151,24 +152,27 @@ class PenService : Service() {
|
||||
super.onScanFailed(errorCode)
|
||||
scanner.stopScan(this)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
private fun overridePeakRefreshRateIfNeeded() {
|
||||
val isPenConnected = inputManager.inputDeviceIds.firstOrNull {
|
||||
val device = inputManager.getInputDevice(it) ?: return@firstOrNull false
|
||||
if (device.vendorId != 0x22D9 && device.vendorId != 0x330A) {
|
||||
// Not an OPPO/Maxeye vendor ID
|
||||
return@firstOrNull false
|
||||
}
|
||||
if (device.bluetoothAddress?.startsWith("C0:87:06") == false &&
|
||||
device.bluetoothAddress?.startsWith("F8:6F:DE") == false) {
|
||||
// Not a Maxeye/Goodix MAC prefix
|
||||
return@firstOrNull false
|
||||
}
|
||||
return@firstOrNull true
|
||||
} != null
|
||||
val isPenConnected =
|
||||
inputManager.inputDeviceIds.firstOrNull {
|
||||
val device = inputManager.getInputDevice(it) ?: return@firstOrNull false
|
||||
if (device.vendorId != 0x22D9 && device.vendorId != 0x330A) {
|
||||
// Not an OPPO/Maxeye vendor ID
|
||||
return@firstOrNull false
|
||||
}
|
||||
if (
|
||||
device.bluetoothAddress?.startsWith("C0:87:06") == false &&
|
||||
device.bluetoothAddress?.startsWith("F8:6F:DE") == false
|
||||
) {
|
||||
// Not a Maxeye/Goodix MAC prefix
|
||||
return@firstOrNull false
|
||||
}
|
||||
return@firstOrNull true
|
||||
} != null
|
||||
val peakRefreshRate = Settings.System.getString(contentResolver, PEAK_REFRESH_RATE)
|
||||
|
||||
if (isPenConnected && peakRefreshRate == "Infinity") {
|
||||
@@ -191,27 +195,29 @@ class PenService : Service() {
|
||||
NotificationChannel(
|
||||
NOTIFICATION_CHANNEL_ID,
|
||||
NOTIFICATION_CHANNEL_ID,
|
||||
NotificationManager.IMPORTANCE_HIGH
|
||||
NotificationManager.IMPORTANCE_HIGH,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
val contentIntent = PendingIntent.getService(
|
||||
this,
|
||||
0,
|
||||
Intent(this, PenService::class.java).apply {
|
||||
putExtra(EXTRA_PENCIL_ADDR, pencilAddr)
|
||||
},
|
||||
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
||||
)
|
||||
val contentIntent =
|
||||
PendingIntent.getService(
|
||||
this,
|
||||
0,
|
||||
Intent(this, PenService::class.java).apply {
|
||||
putExtra(EXTRA_PENCIL_ADDR, pencilAddr)
|
||||
},
|
||||
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT,
|
||||
)
|
||||
|
||||
val notification = Notification.Builder(this, NOTIFICATION_CHANNEL_ID)
|
||||
.setSmallIcon(R.drawable.ic_stylus)
|
||||
.setContentTitle(getString(R.string.pen_attached))
|
||||
.setContentText(getString(R.string.tap_to_connect))
|
||||
.setContentIntent(contentIntent)
|
||||
.setAutoCancel(true)
|
||||
.build()
|
||||
val notification =
|
||||
Notification.Builder(this, NOTIFICATION_CHANNEL_ID)
|
||||
.setSmallIcon(R.drawable.ic_stylus)
|
||||
.setContentTitle(getString(R.string.pen_attached))
|
||||
.setContentText(getString(R.string.tap_to_connect))
|
||||
.setContentIntent(contentIntent)
|
||||
.setAutoCancel(true)
|
||||
.build()
|
||||
notificationManager.notify(NOTIFICATION_ID, notification)
|
||||
}
|
||||
|
||||
|
||||
@@ -49,39 +49,38 @@ namespace android {
|
||||
namespace hardware {
|
||||
namespace vibrator {
|
||||
|
||||
#define STRONG_MAGNITUDE 0x7fff
|
||||
#define MEDIUM_MAGNITUDE 0x5fff
|
||||
#define LIGHT_MAGNITUDE 0x3fff
|
||||
#define INVALID_VALUE -1
|
||||
#define CUSTOM_DATA_LEN 3
|
||||
#define NAME_BUF_SIZE 32
|
||||
#define STRONG_MAGNITUDE 0x7fff
|
||||
#define MEDIUM_MAGNITUDE 0x5fff
|
||||
#define LIGHT_MAGNITUDE 0x3fff
|
||||
#define INVALID_VALUE -1
|
||||
#define CUSTOM_DATA_LEN 3
|
||||
#define NAME_BUF_SIZE 32
|
||||
|
||||
#define MSM_CPU_LAHAINA 415
|
||||
#define APQ_CPU_LAHAINA 439
|
||||
#define MSM_CPU_SHIMA 450
|
||||
#define MSM_CPU_SM8325 501
|
||||
#define APQ_CPU_SM8325P 502
|
||||
#define MSM_CPU_TARO 457
|
||||
#define MSM_CPU_TARO_LTE 552
|
||||
#define MSM_CPU_YUPIK 475
|
||||
#define MSM_CPU_CAPE 530
|
||||
#define APQ_CPU_CAPE 531
|
||||
#define MSM_CPU_KALAMA 519
|
||||
#define MSM_CPU_PINEAPPLE 557
|
||||
#define MSM_CPU_SUN 618
|
||||
#define MSM_CPU_LAHAINA 415
|
||||
#define APQ_CPU_LAHAINA 439
|
||||
#define MSM_CPU_SHIMA 450
|
||||
#define MSM_CPU_SM8325 501
|
||||
#define APQ_CPU_SM8325P 502
|
||||
#define MSM_CPU_TARO 457
|
||||
#define MSM_CPU_TARO_LTE 552
|
||||
#define MSM_CPU_YUPIK 475
|
||||
#define MSM_CPU_CAPE 530
|
||||
#define APQ_CPU_CAPE 531
|
||||
#define MSM_CPU_KALAMA 519
|
||||
#define MSM_CPU_PINEAPPLE 557
|
||||
#define MSM_CPU_SUN 618
|
||||
|
||||
#define test_bit(bit, array) ((array)[(bit)/8] & (1<<((bit)%8)))
|
||||
#define test_bit(bit, array) ((array)[(bit) / 8] & (1 << ((bit) % 8)))
|
||||
|
||||
#define LED_DEVICE "/sys/class/leds/vibrator"
|
||||
|
||||
InputFFDevice::InputFFDevice()
|
||||
{
|
||||
DIR *dp;
|
||||
FILE *fp = NULL;
|
||||
struct dirent *dir;
|
||||
InputFFDevice::InputFFDevice() {
|
||||
DIR* dp;
|
||||
FILE* fp = NULL;
|
||||
struct dirent* dir;
|
||||
uint8_t ffBitmask[FF_CNT / 8];
|
||||
char devicename[PATH_MAX];
|
||||
const char *INPUT_DIR = "/dev/input/";
|
||||
const char* INPUT_DIR = "/dev/input/";
|
||||
char name[NAME_BUF_SIZE];
|
||||
int fd, ret;
|
||||
int soc = property_get_int32("ro.vendor.qti.soc_id", -1);
|
||||
@@ -101,10 +100,9 @@ InputFFDevice::InputFFDevice()
|
||||
}
|
||||
|
||||
memset(ffBitmask, 0, sizeof(ffBitmask));
|
||||
while ((dir = readdir(dp)) != NULL){
|
||||
while ((dir = readdir(dp)) != NULL) {
|
||||
if (dir->d_name[0] == '.' &&
|
||||
(dir->d_name[1] == '\0' ||
|
||||
(dir->d_name[1] == '.' && dir->d_name[2] == '\0')))
|
||||
(dir->d_name[1] == '\0' || (dir->d_name[1] == '.' && dir->d_name[2] == '\0')))
|
||||
continue;
|
||||
|
||||
snprintf(devicename, PATH_MAX, "%s%s", INPUT_DIR, dir->d_name);
|
||||
@@ -135,34 +133,31 @@ InputFFDevice::InputFFDevice()
|
||||
continue;
|
||||
}
|
||||
|
||||
if (test_bit(FF_CONSTANT, ffBitmask) ||
|
||||
test_bit(FF_PERIODIC, ffBitmask)) {
|
||||
if (test_bit(FF_CONSTANT, ffBitmask) || test_bit(FF_PERIODIC, ffBitmask)) {
|
||||
mVibraFd = fd;
|
||||
if (test_bit(FF_CUSTOM, ffBitmask))
|
||||
mSupportEffects = true;
|
||||
if (test_bit(FF_GAIN, ffBitmask))
|
||||
mSupportGain = true;
|
||||
if (test_bit(FF_CUSTOM, ffBitmask)) mSupportEffects = true;
|
||||
if (test_bit(FF_GAIN, ffBitmask)) mSupportGain = true;
|
||||
|
||||
if (soc <= 0 && (fp = fopen("/sys/devices/soc0/soc_id", "r")) != NULL) {
|
||||
fscanf(fp, "%u", &soc);
|
||||
fclose(fp);
|
||||
}
|
||||
switch (soc) {
|
||||
case MSM_CPU_LAHAINA:
|
||||
case APQ_CPU_LAHAINA:
|
||||
case MSM_CPU_SHIMA:
|
||||
case MSM_CPU_SM8325:
|
||||
case APQ_CPU_SM8325P:
|
||||
case MSM_CPU_TARO:
|
||||
case MSM_CPU_YUPIK:
|
||||
case MSM_CPU_KALAMA:
|
||||
case MSM_CPU_PINEAPPLE:
|
||||
case MSM_CPU_SUN:
|
||||
mSupportExternalControl = true;
|
||||
break;
|
||||
default:
|
||||
mSupportExternalControl = false;
|
||||
break;
|
||||
case MSM_CPU_LAHAINA:
|
||||
case APQ_CPU_LAHAINA:
|
||||
case MSM_CPU_SHIMA:
|
||||
case MSM_CPU_SM8325:
|
||||
case APQ_CPU_SM8325P:
|
||||
case MSM_CPU_TARO:
|
||||
case MSM_CPU_YUPIK:
|
||||
case MSM_CPU_KALAMA:
|
||||
case MSM_CPU_PINEAPPLE:
|
||||
case MSM_CPU_SUN:
|
||||
mSupportExternalControl = true;
|
||||
break;
|
||||
default:
|
||||
mSupportExternalControl = false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -191,20 +186,19 @@ InputFFDevice::InputFFDevice()
|
||||
* kernel driver, and the rest two parameters are used for returning
|
||||
* back the real playing length from kernel driver.
|
||||
*/
|
||||
int InputFFDevice::play(int effectId, uint32_t timeoutMs, long *playLengthMs) {
|
||||
int InputFFDevice::play(int effectId, uint32_t timeoutMs, long* playLengthMs) {
|
||||
struct ff_effect effect;
|
||||
struct input_event play;
|
||||
int16_t data[CUSTOM_DATA_LEN] = {0, 0, 0};
|
||||
int ret;
|
||||
#ifdef USE_EFFECT_STREAM
|
||||
const struct effect_stream *stream;
|
||||
const struct effect_stream* stream;
|
||||
#endif
|
||||
|
||||
/* For QMAA compliance, return OK even if vibrator device doesn't exist */
|
||||
if (mVibraFd == INVALID_VALUE) {
|
||||
if (playLengthMs != NULL)
|
||||
*playLengthMs = 0;
|
||||
return 0;
|
||||
if (playLengthMs != NULL) *playLengthMs = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (timeoutMs != 0) {
|
||||
@@ -228,7 +222,7 @@ int InputFFDevice::play(int effectId, uint32_t timeoutMs, long *playLengthMs) {
|
||||
#ifdef USE_EFFECT_STREAM
|
||||
stream = get_effect_stream(effectId);
|
||||
if (stream != NULL) {
|
||||
effect.u.periodic.custom_data = (int16_t *)stream;
|
||||
effect.u.periodic.custom_data = (int16_t*)stream;
|
||||
effect.u.periodic.custom_len = sizeof(*stream);
|
||||
}
|
||||
#endif
|
||||
@@ -265,8 +259,7 @@ int InputFFDevice::play(int effectId, uint32_t timeoutMs, long *playLengthMs) {
|
||||
if (ret == -1) {
|
||||
ALOGE("write failed, errno = %d\n", -errno);
|
||||
ret = TEMP_FAILURE_RETRY(ioctl(mVibraFd, EVIOCRMFF, mCurrAppId));
|
||||
if (ret == -1)
|
||||
ALOGE("ioctl EVIOCRMFF failed, errno = %d", -errno);
|
||||
if (ret == -1) ALOGE("ioctl EVIOCRMFF failed, errno = %d", -errno);
|
||||
goto errout;
|
||||
}
|
||||
} else if (mCurrAppId != INVALID_VALUE) {
|
||||
@@ -297,8 +290,7 @@ int InputFFDevice::setAmplitude(uint8_t amplitude) {
|
||||
struct input_event ie;
|
||||
|
||||
/* For QMAA compliance, return OK even if vibrator device doesn't exist */
|
||||
if (mVibraFd == INVALID_VALUE)
|
||||
return 0;
|
||||
if (mVibraFd == INVALID_VALUE) return 0;
|
||||
|
||||
tmp = amplitude * (STRONG_MAGNITUDE - LIGHT_MAGNITUDE) / 255;
|
||||
tmp += LIGHT_MAGNITUDE;
|
||||
@@ -316,19 +308,19 @@ int InputFFDevice::setAmplitude(uint8_t amplitude) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int InputFFDevice::playEffect(int effectId, EffectStrength es, long *playLengthMs) {
|
||||
int InputFFDevice::playEffect(int effectId, EffectStrength es, long* playLengthMs) {
|
||||
switch (es) {
|
||||
case EffectStrength::LIGHT:
|
||||
mCurrMagnitude = LIGHT_MAGNITUDE;
|
||||
break;
|
||||
case EffectStrength::MEDIUM:
|
||||
mCurrMagnitude = MEDIUM_MAGNITUDE;
|
||||
break;
|
||||
case EffectStrength::STRONG:
|
||||
mCurrMagnitude = STRONG_MAGNITUDE;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
case EffectStrength::LIGHT:
|
||||
mCurrMagnitude = LIGHT_MAGNITUDE;
|
||||
break;
|
||||
case EffectStrength::MEDIUM:
|
||||
mCurrMagnitude = MEDIUM_MAGNITUDE;
|
||||
break;
|
||||
case EffectStrength::STRONG:
|
||||
mCurrMagnitude = STRONG_MAGNITUDE;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
return play(effectId, INVALID_VALUE, playLengthMs);
|
||||
@@ -350,7 +342,7 @@ LedVibratorDevice::LedVibratorDevice() {
|
||||
mDetected = true;
|
||||
}
|
||||
|
||||
int LedVibratorDevice::write_value(const char *file, const char *value) {
|
||||
int LedVibratorDevice::write_value(const char* file, const char* value) {
|
||||
int fd;
|
||||
int ret;
|
||||
|
||||
@@ -379,7 +371,7 @@ int LedVibratorDevice::write_value(const char *file, const char *value) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LedVibratorDevice::write_value(const char *file, int value) {
|
||||
int LedVibratorDevice::write_value(const char* file, int value) {
|
||||
return write_value(file, std::to_string(value).c_str());
|
||||
}
|
||||
|
||||
@@ -410,8 +402,7 @@ int LedVibratorDevice::onWaveform(int waveformIndex) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LedVibratorDevice::off()
|
||||
{
|
||||
int LedVibratorDevice::off() {
|
||||
char file[PATH_MAX];
|
||||
int ret;
|
||||
|
||||
@@ -429,12 +420,9 @@ ndk::ScopedAStatus Vibrator::getCapabilities(int32_t* _aidl_return) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
if (ff.mSupportGain)
|
||||
*_aidl_return |= IVibrator::CAP_AMPLITUDE_CONTROL;
|
||||
if (ff.mSupportEffects)
|
||||
*_aidl_return |= IVibrator::CAP_PERFORM_CALLBACK;
|
||||
if (ff.mSupportExternalControl)
|
||||
*_aidl_return |= IVibrator::CAP_EXTERNAL_CONTROL;
|
||||
if (ff.mSupportGain) *_aidl_return |= IVibrator::CAP_AMPLITUDE_CONTROL;
|
||||
if (ff.mSupportEffects) *_aidl_return |= IVibrator::CAP_PERFORM_CALLBACK;
|
||||
if (ff.mSupportExternalControl) *_aidl_return |= IVibrator::CAP_EXTERNAL_CONTROL;
|
||||
|
||||
ALOGD("QTI Vibrator reporting capabilities: %d", *_aidl_return);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
@@ -448,8 +436,7 @@ ndk::ScopedAStatus Vibrator::off() {
|
||||
ret = ledVib.off();
|
||||
else
|
||||
ret = ff.off();
|
||||
if (ret != 0)
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC));
|
||||
if (ret != 0) return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC));
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
@@ -464,8 +451,7 @@ ndk::ScopedAStatus Vibrator::on(int32_t timeoutMs,
|
||||
else
|
||||
ret = ff.on(timeoutMs);
|
||||
|
||||
if (ret != 0)
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC));
|
||||
if (ret != 0) return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC));
|
||||
|
||||
if (callback != nullptr) {
|
||||
std::thread([=] {
|
||||
@@ -481,7 +467,9 @@ ndk::ScopedAStatus Vibrator::on(int32_t timeoutMs,
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus Vibrator::perform(Effect effect, EffectStrength es, const std::shared_ptr<IVibratorCallback>& callback, int32_t* _aidl_return) {
|
||||
ndk::ScopedAStatus Vibrator::perform(Effect effect, EffectStrength es,
|
||||
const std::shared_ptr<IVibratorCallback>& callback,
|
||||
int32_t* _aidl_return) {
|
||||
long playLengthMs;
|
||||
int ret;
|
||||
|
||||
@@ -489,28 +477,28 @@ ndk::ScopedAStatus Vibrator::perform(Effect effect, EffectStrength es, const std
|
||||
|
||||
if (ledVib.mDetected) {
|
||||
switch (effect) {
|
||||
case Effect::CLICK:
|
||||
ledVib.write_value(LED_DEVICE "/vmax", "2500");
|
||||
ledVib.write_value(LED_DEVICE "/waveform_index", "1");
|
||||
break;
|
||||
case Effect::DOUBLE_CLICK:
|
||||
ledVib.write_value(LED_DEVICE "/vmax", "2500");
|
||||
ledVib.write_value(LED_DEVICE "/waveform_index", "1");
|
||||
break;
|
||||
case Effect::TICK:
|
||||
ledVib.write_value(LED_DEVICE "/vmax", "1400");
|
||||
ledVib.write_value(LED_DEVICE "/waveform_index", "1");
|
||||
break;
|
||||
case Effect::HEAVY_CLICK:
|
||||
ledVib.write_value(LED_DEVICE "/vmax", "2500");
|
||||
ledVib.write_value(LED_DEVICE "/waveform_index", "4");
|
||||
break;
|
||||
case Effect::TEXTURE_TICK:
|
||||
ledVib.write_value(LED_DEVICE "/vmax", "60");
|
||||
ledVib.write_value(LED_DEVICE "/waveform_index", "2");
|
||||
break;
|
||||
default:
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
|
||||
case Effect::CLICK:
|
||||
ledVib.write_value(LED_DEVICE "/vmax", "2500");
|
||||
ledVib.write_value(LED_DEVICE "/waveform_index", "1");
|
||||
break;
|
||||
case Effect::DOUBLE_CLICK:
|
||||
ledVib.write_value(LED_DEVICE "/vmax", "2500");
|
||||
ledVib.write_value(LED_DEVICE "/waveform_index", "1");
|
||||
break;
|
||||
case Effect::TICK:
|
||||
ledVib.write_value(LED_DEVICE "/vmax", "1400");
|
||||
ledVib.write_value(LED_DEVICE "/waveform_index", "1");
|
||||
break;
|
||||
case Effect::HEAVY_CLICK:
|
||||
ledVib.write_value(LED_DEVICE "/vmax", "2500");
|
||||
ledVib.write_value(LED_DEVICE "/waveform_index", "4");
|
||||
break;
|
||||
case Effect::TEXTURE_TICK:
|
||||
ledVib.write_value(LED_DEVICE "/vmax", "60");
|
||||
ledVib.write_value(LED_DEVICE "/waveform_index", "2");
|
||||
break;
|
||||
default:
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
|
||||
}
|
||||
|
||||
if (effect == Effect::DOUBLE_CLICK) {
|
||||
@@ -524,16 +512,15 @@ ndk::ScopedAStatus Vibrator::perform(Effect effect, EffectStrength es, const std
|
||||
// Return magic value for play length so that we won't end up calling on() / off()
|
||||
playLengthMs = 150;
|
||||
} else {
|
||||
if (effect < Effect::CLICK || effect > Effect::HEAVY_CLICK)
|
||||
if (effect < Effect::CLICK || effect > Effect::HEAVY_CLICK)
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
|
||||
|
||||
if (es != EffectStrength::LIGHT && es != EffectStrength::MEDIUM &&
|
||||
es != EffectStrength::STRONG)
|
||||
es != EffectStrength::STRONG)
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
|
||||
|
||||
ret = ff.playEffect((static_cast<int>(effect)), es, &playLengthMs);
|
||||
if (ret != 0)
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC));
|
||||
if (ret != 0) return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC));
|
||||
}
|
||||
|
||||
if (callback != nullptr) {
|
||||
@@ -554,8 +541,8 @@ ndk::ScopedAStatus Vibrator::getSupportedEffects(std::vector<Effect>* _aidl_retu
|
||||
*_aidl_return = {Effect::CLICK, Effect::DOUBLE_CLICK, Effect::TICK, Effect::HEAVY_CLICK,
|
||||
Effect::TEXTURE_TICK};
|
||||
} else {
|
||||
*_aidl_return = {Effect::CLICK, Effect::DOUBLE_CLICK, Effect::TICK, Effect::THUD,
|
||||
Effect::POP, Effect::HEAVY_CLICK};
|
||||
*_aidl_return = {Effect::CLICK, Effect::DOUBLE_CLICK, Effect::TICK,
|
||||
Effect::THUD, Effect::POP, Effect::HEAVY_CLICK};
|
||||
}
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
@@ -577,8 +564,7 @@ ndk::ScopedAStatus Vibrator::setAmplitude(float amplitude) {
|
||||
|
||||
tmp = (uint8_t)(amplitude * 0xff);
|
||||
ret = ff.setAmplitude(tmp);
|
||||
if (ret != 0)
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC));
|
||||
if (ret != 0) return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC));
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
@@ -595,7 +581,7 @@ ndk::ScopedAStatus Vibrator::setExternalControl(bool enabled) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus Vibrator::getCompositionDelayMax(int32_t* maxDelayMs __unused) {
|
||||
ndk::ScopedAStatus Vibrator::getCompositionDelayMax(int32_t* maxDelayMs __unused) {
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
|
||||
}
|
||||
|
||||
@@ -603,7 +589,8 @@ ndk::ScopedAStatus Vibrator::getCompositionSizeMax(int32_t* maxSize __unused) {
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus Vibrator::getSupportedPrimitives(std::vector<CompositePrimitive>* supported __unused) {
|
||||
ndk::ScopedAStatus Vibrator::getSupportedPrimitives(
|
||||
std::vector<CompositePrimitive>* supported __unused) {
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
|
||||
}
|
||||
|
||||
@@ -617,7 +604,8 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect>& composi
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus Vibrator::getSupportedAlwaysOnEffects(std::vector<Effect>* _aidl_return __unused) {
|
||||
ndk::ScopedAStatus Vibrator::getSupportedAlwaysOnEffects(
|
||||
std::vector<Effect>* _aidl_return __unused) {
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
|
||||
}
|
||||
|
||||
@@ -634,4 +622,3 @@ ndk::ScopedAStatus Vibrator::alwaysOnDisable(int32_t id __unused) {
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
|
||||
|
||||
@@ -131,202 +131,172 @@ static const int8_t effect_1[] = {
|
||||
};
|
||||
|
||||
static const int8_t effect_2[] = {
|
||||
1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4,
|
||||
4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 16, 19,
|
||||
22, 25, 28, 32, 36, 42, 48, 54, 61, 69, 78, 85,
|
||||
92, 97, 102, 106, 110, 113, 115, 117, 119, 121, 121, 123,
|
||||
123, 123, 124, 124, 124, 123, 123, 123, 122, 121, 121, 120,
|
||||
119, 118, 117, 115, 114, 113, 112, 111, 109, 108, 106, 105,
|
||||
103, 101, 99, 97, 95, 93, 91, 89, 86, 83, 80, 77,
|
||||
73, 69, 64, 60, 54, 48, 41, 34, 25, 15, 4, -7,
|
||||
-22, -37, -51, -64, -74, -83, -91, -99, -104, -109, -112, -115,
|
||||
-119, -120, -122, -122, -123, -122, -122, -122, -120, -120, -118, -116,
|
||||
-114, -112, -110, -107, -105, -103, -99, -97, -95, -91, -89, -86,
|
||||
-83, -80, -77, -74, -71, -68, -64, -61, -58, -55, -52, -49,
|
||||
-46, -43, -40, -36, -33, -29, -26, -22, -18, -14, -10, -5,
|
||||
0, 6, 12, 19, 27, 35, 42, 47, 52, 57, 60, 63,
|
||||
65, 66, 67, 68, 68, 67, 67, 66, 64, 62, 61, 58,
|
||||
56, 53, 51, 49, 45, 43, 39, 35, 33, 29, 26, 22,
|
||||
19, 15, 12, 8, 5, 1, -2, -5, -9, -12, -14, -17,
|
||||
-20, -22, -25, -27, -28, -30, -32, -32, -34, -34, -34, -34,
|
||||
-33, -31, -29, -27, -24, -21, -16, -11, -4, 2, 8, 14,
|
||||
19, 23, 27, 31, 35, 38, 42, 45, 48, 51, 54, 56,
|
||||
58, 62, 65, 67, 69, 72, 75, 78, 80, 83, 86, 88,
|
||||
91, 94, 97, 99, 102, 104, 107, 109, 111, 114, 116, 118,
|
||||
120, 121, 123, 124, 125, 126, 127, 127, 127, 127, 127, 126,
|
||||
124, 123, 120, 117, 113, 109, 103, 96, 89, 80, 70, 58,
|
||||
45, 32, 21, 11, 2, -6, -12, -18, -24, -29, -33, -37,
|
||||
-41, -43, -47, -49, -51, -54, -56, -58, -59, -61, -62, -64,
|
||||
-65, -66, -67, -68, -69, -70, -71, -72, -73, -74, -75, -76,
|
||||
-77, -77, -78, -78, -79, -79, -80, -80, -80, -80, -80, -80,
|
||||
-80, -80, -79, -79, -78, -77, -75, -74, -72, -70, -67, -64,
|
||||
-61, -57, -53, -47, -42, -37, -32, -28, -25, -22, -19, -16,
|
||||
-15, -12, -11, -10, -8, -7, -6, -6, -5, -4, -4, -3,
|
||||
-3, -3, -3, -2, -2, -2, -2, -2, -2, -2, -1, 0
|
||||
};
|
||||
1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 6,
|
||||
7, 8, 9, 10, 12, 13, 14, 16, 19, 22, 25, 28, 32, 36, 42,
|
||||
48, 54, 61, 69, 78, 85, 92, 97, 102, 106, 110, 113, 115, 117, 119,
|
||||
121, 121, 123, 123, 123, 124, 124, 124, 123, 123, 123, 122, 121, 121, 120,
|
||||
119, 118, 117, 115, 114, 113, 112, 111, 109, 108, 106, 105, 103, 101, 99,
|
||||
97, 95, 93, 91, 89, 86, 83, 80, 77, 73, 69, 64, 60, 54, 48,
|
||||
41, 34, 25, 15, 4, -7, -22, -37, -51, -64, -74, -83, -91, -99, -104,
|
||||
-109, -112, -115, -119, -120, -122, -122, -123, -122, -122, -122, -120, -120, -118, -116,
|
||||
-114, -112, -110, -107, -105, -103, -99, -97, -95, -91, -89, -86, -83, -80, -77,
|
||||
-74, -71, -68, -64, -61, -58, -55, -52, -49, -46, -43, -40, -36, -33, -29,
|
||||
-26, -22, -18, -14, -10, -5, 0, 6, 12, 19, 27, 35, 42, 47, 52,
|
||||
57, 60, 63, 65, 66, 67, 68, 68, 67, 67, 66, 64, 62, 61, 58,
|
||||
56, 53, 51, 49, 45, 43, 39, 35, 33, 29, 26, 22, 19, 15, 12,
|
||||
8, 5, 1, -2, -5, -9, -12, -14, -17, -20, -22, -25, -27, -28, -30,
|
||||
-32, -32, -34, -34, -34, -34, -33, -31, -29, -27, -24, -21, -16, -11, -4,
|
||||
2, 8, 14, 19, 23, 27, 31, 35, 38, 42, 45, 48, 51, 54, 56,
|
||||
58, 62, 65, 67, 69, 72, 75, 78, 80, 83, 86, 88, 91, 94, 97,
|
||||
99, 102, 104, 107, 109, 111, 114, 116, 118, 120, 121, 123, 124, 125, 126,
|
||||
127, 127, 127, 127, 127, 126, 124, 123, 120, 117, 113, 109, 103, 96, 89,
|
||||
80, 70, 58, 45, 32, 21, 11, 2, -6, -12, -18, -24, -29, -33, -37,
|
||||
-41, -43, -47, -49, -51, -54, -56, -58, -59, -61, -62, -64, -65, -66, -67,
|
||||
-68, -69, -70, -71, -72, -73, -74, -75, -76, -77, -77, -78, -78, -79, -79,
|
||||
-80, -80, -80, -80, -80, -80, -80, -80, -79, -79, -78, -77, -75, -74, -72,
|
||||
-70, -67, -64, -61, -57, -53, -47, -42, -37, -32, -28, -25, -22, -19, -16,
|
||||
-15, -12, -11, -10, -8, -7, -6, -6, -5, -4, -4, -3, -3, -3, -3,
|
||||
-2, -2, -2, -2, -2, -2, -2, -1, 0};
|
||||
|
||||
static const int8_t effect_3[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
|
||||
1, 2, 2, 3, 4, 6, 7, 9, 11, 14, 16, 19,
|
||||
22, 26, 29, 33, 37, 41, 45, 49, 54, 58, 62, 66,
|
||||
70, 74, 78, 81, 85, 88, 91, 94, 97, 99, 101, 103,
|
||||
105, 106, 108, 108, 109, 110, 110, 110, 109, 109, 108, 107,
|
||||
105, 104, 102, 100, 98, 96, 93, 90, 87, 84, 81, 78,
|
||||
74, 70, 67, 63, 59, 54, 50, 46, 41, 37, 32, 28,
|
||||
23, 18, 13, 9, 4, -1, -6, -11, -15, -20, -25, -29,
|
||||
-34, -39, -43, -47, -52, -56, -60, -64, -68, -71, -75, -78,
|
||||
-82, -85, -88, -90, -93, -95, -97, -99, -101, -103, -104, -106,
|
||||
-107, -107, -108, -108, -108, -108, -108, -107, -107, -106, -105, -103,
|
||||
-102, -100, -98, -96, -94, -91, -88, -86, -83, -79, -76, -72,
|
||||
-69, -65, -61, -57, -53, -49, -44, -40, -35, -31, -26, -21,
|
||||
-17, -12, -7, -2, 3, 7, 12, 17, 22, 27, 31, 36,
|
||||
40, 45, 49, 53, 57, 61, 65, 69, 73, 76, 80, 83,
|
||||
86, 89, 91, 94, 96, 98, 100, 102, 104, 105, 106, 107,
|
||||
108, 108, 108, 108, 108, 108, 107, 106, 105, 104, 103, 101,
|
||||
99, 97, 95, 93, 90, 87, 84, 81, 75, 72, 68, 65,
|
||||
61, 58, 54, 51, 47, 44, 41, 38, 35, 32, 30, 27,
|
||||
24, 22, 19, 16, 14, 11, 8, 6, 3, 1, -2, -4,
|
||||
-6, -8, -10, -11, -13, -14, -15, -16, -17, -18, -19, -20,
|
||||
-20, -21, -21, -21, -21, -22, -22, -22, -22, -22, -22, -22,
|
||||
-22, -22, -21, -21, -21, -21, -21, -20, -20, -20, -20, -19,
|
||||
-19, -18, -18, -18, -17, -17, -16, -16, -15, -14, -14, -13,
|
||||
-12, -12, -11, -10, -9, -9, -8, -7, -6, -5, -4, -3,
|
||||
-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
8, 9, 10, 11, 12, 13, 13, 14, 15, 15, 16, 17,
|
||||
17, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21,
|
||||
21, 21, 21, 21, 21, 21, 21, 21, 20, 20, 20, 19,
|
||||
19, 19, 18, 18, 17, 16, 16, 15, 15, 14, 13, 12,
|
||||
12, 11, 10, 9, 8, 8, 7, 6, 5, 4, 3, 2,
|
||||
1, 0, -1, -2, -3, -4, -4, -5, -6, -7, -8, -9,
|
||||
-10, -11, -11, -12, -13, -14, -14, -15, -16, -16, -17, -17,
|
||||
-18, -18, -19, -19, -20, -20, -20, -20, -21, -21, -21, -21,
|
||||
-21, -21, -21, -21, -21, -21, -20, -20, -20, -20, -19, -19,
|
||||
-18, -18, -17, -17, -16, -16, -15, -14, -14, -13, -12, -11,
|
||||
-11, -10, -9, -8, -7, -6, -5, -4, -4, -3, -2, -1,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 10,
|
||||
11, 12, 12, 13, 14, 15, 15, 16, 16, 17, 18, 18,
|
||||
19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 21,
|
||||
21, 21, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18,
|
||||
18, 17, 17, 16, 15, 15, 14, 13, 13, 12, 11, 10,
|
||||
9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1,
|
||||
-1, -2, -3, -4, -5, -6, -7, -8, -9, -9, -10, -11,
|
||||
-12, -13, -13, -14, -15, -15, -16, -17, -17, -18, -18, -19,
|
||||
-19, -19, -20, -20, -20, -21, -21, -21, -21, -21, -21, -21,
|
||||
-21, -21, -21, -20, -20, -20, -20, -19, -19, -18, -18, -18,
|
||||
-17, -16, -16, -15, -15, -14, -13, -12, -12, -11, -10, -9,
|
||||
-8, -7, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2,
|
||||
3, 4, 4, 5, 6, 7, 8, 9, 10, 11, 11, 12,
|
||||
13, 14, 14, 15, 16, 16, 17, 17, 18, 18, 19, 19,
|
||||
20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21,
|
||||
21, 21, 20, 20, 20, 20, 19, 19, 18, 18, 17, 17,
|
||||
16, 16, 15, 14, 14, 13, 12, 11, 10, 10, 9, 8,
|
||||
7, 6, 5, 4, 3, 3, 2, 1, 0, -1, -2, -3,
|
||||
-4, -5, -6, -7, -8, -8, -10, -10, -11, -12, -13, -14,
|
||||
-14, -15, -16, -16, -17, -17, -17, -17, -17, -17, -16, -14,
|
||||
-12, -10, -7, -4, 0, 4, 8, 13, 19, 24, 30, 36,
|
||||
42, 48, 53, 59, 64, 69, 74, 78, 82, 85, 87, 89,
|
||||
91, 92, 92, 91, 89, 87, 83, 79, 73, 67, 60, 52,
|
||||
44, 36, 27, 18, 10, 1, -7, -14, -22, -29, -36, -43,
|
||||
-50, -56, -62, -69, -75, -81, -86, -92, -97, -102, -107, -111,
|
||||
-115, -118, -121, -123, -124, -126, -127, -127, -127, -127, -127, -127,
|
||||
-127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,
|
||||
-126, -124, -122, -120, -117, -114, -110, -106, -101, -96, -90, -84,
|
||||
-79, -73, -67, -60, -54, -48, -42, -36, -30, -24, -18, -13,
|
||||
-7, -1, 4, 9, 14, 19, 24, 28, 33, 37, 41, 44,
|
||||
48, 51, 54, 57, 60, 62, 64, 66, 68, 69, 70, 71,
|
||||
72, 73, 73, 73, 73, 73, 73, 72, 71, 71, 70, 68,
|
||||
67, 66, 64, 63, 61, 59, 57, 55, 53, 51, 49, 46,
|
||||
44, 42, 39, 37, 35, 32, 30, 28, 25, 23, 21, 18,
|
||||
16, 14, 12, 10, 8, 6, 4, 2, 1, -1, -3, -4,
|
||||
-5, -7, -8, -9, -10, -11, -12, -13, -14, -15, -15, -16,
|
||||
-16, -16, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17,
|
||||
-17, -16, -16, -15, -15, -15, -14, -14, -13, -13, -12, -11,
|
||||
-11, -10, -10, -9, -8, -8, -7, -7, -6, -5, -5, -4,
|
||||
-4, -3, -3, -2, -2, -1, -1, 0
|
||||
};
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2,
|
||||
3, 4, 6, 7, 9, 11, 14, 16, 19, 22, 26, 29, 33, 37, 41,
|
||||
45, 49, 54, 58, 62, 66, 70, 74, 78, 81, 85, 88, 91, 94, 97,
|
||||
99, 101, 103, 105, 106, 108, 108, 109, 110, 110, 110, 109, 109, 108, 107,
|
||||
105, 104, 102, 100, 98, 96, 93, 90, 87, 84, 81, 78, 74, 70, 67,
|
||||
63, 59, 54, 50, 46, 41, 37, 32, 28, 23, 18, 13, 9, 4, -1,
|
||||
-6, -11, -15, -20, -25, -29, -34, -39, -43, -47, -52, -56, -60, -64, -68,
|
||||
-71, -75, -78, -82, -85, -88, -90, -93, -95, -97, -99, -101, -103, -104, -106,
|
||||
-107, -107, -108, -108, -108, -108, -108, -107, -107, -106, -105, -103, -102, -100, -98,
|
||||
-96, -94, -91, -88, -86, -83, -79, -76, -72, -69, -65, -61, -57, -53, -49,
|
||||
-44, -40, -35, -31, -26, -21, -17, -12, -7, -2, 3, 7, 12, 17, 22,
|
||||
27, 31, 36, 40, 45, 49, 53, 57, 61, 65, 69, 73, 76, 80, 83,
|
||||
86, 89, 91, 94, 96, 98, 100, 102, 104, 105, 106, 107, 108, 108, 108,
|
||||
108, 108, 108, 107, 106, 105, 104, 103, 101, 99, 97, 95, 93, 90, 87,
|
||||
84, 81, 75, 72, 68, 65, 61, 58, 54, 51, 47, 44, 41, 38, 35,
|
||||
32, 30, 27, 24, 22, 19, 16, 14, 11, 8, 6, 3, 1, -2, -4,
|
||||
-6, -8, -10, -11, -13, -14, -15, -16, -17, -18, -19, -20, -20, -21, -21,
|
||||
-21, -21, -22, -22, -22, -22, -22, -22, -22, -22, -22, -21, -21, -21, -21,
|
||||
-21, -20, -20, -20, -20, -19, -19, -18, -18, -18, -17, -17, -16, -16, -15,
|
||||
-14, -14, -13, -12, -12, -11, -10, -9, -9, -8, -7, -6, -5, -4, -3,
|
||||
-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 10,
|
||||
11, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, 18, 19, 19, 19,
|
||||
20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20,
|
||||
20, 20, 19, 19, 19, 18, 18, 17, 16, 16, 15, 15, 14, 13, 12,
|
||||
12, 11, 10, 9, 8, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1,
|
||||
-2, -3, -4, -4, -5, -6, -7, -8, -9, -10, -11, -11, -12, -13, -14,
|
||||
-14, -15, -16, -16, -17, -17, -18, -18, -19, -19, -20, -20, -20, -20, -21,
|
||||
-21, -21, -21, -21, -21, -21, -21, -21, -21, -20, -20, -20, -20, -19, -19,
|
||||
-18, -18, -17, -17, -16, -16, -15, -14, -14, -13, -12, -11, -11, -10, -9,
|
||||
-8, -7, -6, -5, -4, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5,
|
||||
6, 7, 8, 8, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16,
|
||||
17, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 21,
|
||||
21, 21, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 17, 17,
|
||||
16, 15, 15, 14, 13, 13, 12, 11, 10, 9, 9, 8, 7, 6, 5,
|
||||
4, 3, 2, 1, 0, -1, -1, -2, -3, -4, -5, -6, -7, -8, -9,
|
||||
-9, -10, -11, -12, -13, -13, -14, -15, -15, -16, -17, -17, -18, -18, -19,
|
||||
-19, -19, -20, -20, -20, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21,
|
||||
-20, -20, -20, -20, -19, -19, -18, -18, -18, -17, -16, -16, -15, -15, -14,
|
||||
-13, -12, -12, -11, -10, -9, -8, -7, -7, -6, -5, -4, -3, -2, -1,
|
||||
0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10, 11, 11, 12,
|
||||
13, 14, 14, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20,
|
||||
20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 20, 20, 20,
|
||||
19, 19, 18, 18, 17, 17, 16, 16, 15, 14, 14, 13, 12, 11, 10,
|
||||
10, 9, 8, 7, 6, 5, 4, 3, 3, 2, 1, 0, -1, -2, -3,
|
||||
-4, -5, -6, -7, -8, -8, -10, -10, -11, -12, -13, -14, -14, -15, -16,
|
||||
-16, -17, -17, -17, -17, -17, -17, -16, -14, -12, -10, -7, -4, 0, 4,
|
||||
8, 13, 19, 24, 30, 36, 42, 48, 53, 59, 64, 69, 74, 78, 82,
|
||||
85, 87, 89, 91, 92, 92, 91, 89, 87, 83, 79, 73, 67, 60, 52,
|
||||
44, 36, 27, 18, 10, 1, -7, -14, -22, -29, -36, -43, -50, -56, -62,
|
||||
-69, -75, -81, -86, -92, -97, -102, -107, -111, -115, -118, -121, -123, -124, -126,
|
||||
-127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,
|
||||
-127, -127, -127, -126, -124, -122, -120, -117, -114, -110, -106, -101, -96, -90, -84,
|
||||
-79, -73, -67, -60, -54, -48, -42, -36, -30, -24, -18, -13, -7, -1, 4,
|
||||
9, 14, 19, 24, 28, 33, 37, 41, 44, 48, 51, 54, 57, 60, 62,
|
||||
64, 66, 68, 69, 70, 71, 72, 73, 73, 73, 73, 73, 73, 72, 71,
|
||||
71, 70, 68, 67, 66, 64, 63, 61, 59, 57, 55, 53, 51, 49, 46,
|
||||
44, 42, 39, 37, 35, 32, 30, 28, 25, 23, 21, 18, 16, 14, 12,
|
||||
10, 8, 6, 4, 2, 1, -1, -3, -4, -5, -7, -8, -9, -10, -11,
|
||||
-12, -13, -14, -15, -15, -16, -16, -16, -17, -17, -17, -17, -17, -17, -17,
|
||||
-17, -17, -17, -17, -16, -16, -15, -15, -15, -14, -14, -13, -13, -12, -11,
|
||||
-11, -10, -10, -9, -8, -8, -7, -7, -6, -5, -5, -4, -4, -3, -3,
|
||||
-2, -2, -1, -1, 0};
|
||||
|
||||
static const int8_t effect_4[] = {
|
||||
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2,
|
||||
2, 2, 3, 3, 4, 4, 5, 6, 7, 8, 9, 10,
|
||||
12, 13, 15, 17, 19, 22, 25, 28, 32, 37, 42, 48,
|
||||
55, 62, 70, 79, 86, 92, 97, 102, 107, 110, 113, 115,
|
||||
117, 119, 121, 121, 123, 123, 123, 124, 124, 124, 123, 123,
|
||||
123, 121, 121, 121, 119, 119, 118, 117, 115, 114, 113, 112,
|
||||
110, 109, 107, 106, 105, 102, 101, 99, 97, 95, 93, 91,
|
||||
89, 86, 83, 80, 77, 73, 69, 64, 60, 54, 48, 41,
|
||||
33, 24, 14, 3, -9, -23, -38, -52, -65, -75, -84, -92,
|
||||
-99, -104, -109, -113, -115, -119, -120, -122, -122, -123, -122, -122,
|
||||
-121, -120, -119, -118, -116, -114, -112, -110, -107, -105, -102, -99,
|
||||
-97, -94, -91, -88, -85, -82, -79, -76, -74, -70, -68, -64,
|
||||
-61, -58, -55, -52, -49, -46, -43, -39, -36, -33, -29, -26,
|
||||
-22, -18, -14, -10, -5, 0, 7, 13, 20, 28, 35, 42,
|
||||
48, 53, 58, 60, 63, 65, 66, 67, 68, 68, 67, 67,
|
||||
66, 64, 62, 61, 58, 56, 53, 51, 48, 45, 42, 38,
|
||||
35, 33, 28, 26, 22, 19, 15, 12, 8, 5, 1, -2,
|
||||
-5, -9, -12, -14, -17, -20, -22, -25, -28, -29, -30, -32,
|
||||
-32, -34, -34, -34, -33, -33, -31, -29, -27, -24, -20, -16,
|
||||
-10, -3, 3, 9, 14, 19, 24, 27, 32, 35, 38, 42,
|
||||
45, 48, 51, 54, 57, 59, 62, 65, 68, 70, 73, 76,
|
||||
78, 80, 84, 86, 88, 91, 94, 97, 99, 102, 104, 107,
|
||||
109, 111, 114, 116, 118, 120, 121, 123, 124, 125, 126, 127,
|
||||
127, 127, 127, 127, 125, 124, 123, 120, 117, 113, 108, 102,
|
||||
96, 88, 79, 69, 57, 44, 31, 20, 10, 2, -6, -13,
|
||||
-19, -24, -29, -33, -37, -41, -44, -47, -49, -52, -54, -56,
|
||||
-58, -59, -61, -62, -64, -66, -66, -67, -68, -69, -70, -71,
|
||||
-72, -73, -74, -75, -76, -77, -77, -78, -78, -79, -79, -80,
|
||||
-80, -80, -80, -80, -80, -80, -80, -79, -79, -78, -77, -75,
|
||||
-74, -72, -70, -67, -64, -61, -56, -52, -46, -41, -36, -31,
|
||||
-27, -24, -21, -18, -16, -14, -12, -11, -9, -8, -7, -6,
|
||||
-6, -5, -4, -4, -3, -3, -3, -3, -2, -2, -2, -2,
|
||||
-2, -2, -2, -1, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3,
|
||||
3, 4, 4, 5, 6, 7, 8, 9, 10, 12, 13, 15, 17, 19, 22,
|
||||
25, 28, 32, 37, 42, 48, 55, 62, 70, 79, 86, 92, 97, 102, 107,
|
||||
110, 113, 115, 117, 119, 121, 121, 123, 123, 123, 124, 124, 124, 123, 123,
|
||||
123, 121, 121, 121, 119, 119, 118, 117, 115, 114, 113, 112, 110, 109, 107,
|
||||
106, 105, 102, 101, 99, 97, 95, 93, 91, 89, 86, 83, 80, 77, 73,
|
||||
69, 64, 60, 54, 48, 41, 33, 24, 14, 3, -9, -23, -38, -52, -65,
|
||||
-75, -84, -92, -99, -104, -109, -113, -115, -119, -120, -122, -122, -123, -122, -122,
|
||||
-121, -120, -119, -118, -116, -114, -112, -110, -107, -105, -102, -99, -97, -94, -91,
|
||||
-88, -85, -82, -79, -76, -74, -70, -68, -64, -61, -58, -55, -52, -49, -46,
|
||||
-43, -39, -36, -33, -29, -26, -22, -18, -14, -10, -5, 0, 7, 13, 20,
|
||||
28, 35, 42, 48, 53, 58, 60, 63, 65, 66, 67, 68, 68, 67, 67,
|
||||
66, 64, 62, 61, 58, 56, 53, 51, 48, 45, 42, 38, 35, 33, 28,
|
||||
26, 22, 19, 15, 12, 8, 5, 1, -2, -5, -9, -12, -14, -17, -20,
|
||||
-22, -25, -28, -29, -30, -32, -32, -34, -34, -34, -33, -33, -31, -29, -27,
|
||||
-24, -20, -16, -10, -3, 3, 9, 14, 19, 24, 27, 32, 35, 38, 42,
|
||||
45, 48, 51, 54, 57, 59, 62, 65, 68, 70, 73, 76, 78, 80, 84,
|
||||
86, 88, 91, 94, 97, 99, 102, 104, 107, 109, 111, 114, 116, 118, 120,
|
||||
121, 123, 124, 125, 126, 127, 127, 127, 127, 127, 125, 124, 123, 120, 117,
|
||||
113, 108, 102, 96, 88, 79, 69, 57, 44, 31, 20, 10, 2, -6, -13,
|
||||
-19, -24, -29, -33, -37, -41, -44, -47, -49, -52, -54, -56, -58, -59, -61,
|
||||
-62, -64, -66, -66, -67, -68, -69, -70, -71, -72, -73, -74, -75, -76, -77,
|
||||
-77, -78, -78, -79, -79, -80, -80, -80, -80, -80, -80, -80, -80, -79, -79,
|
||||
-78, -77, -75, -74, -72, -70, -67, -64, -61, -56, -52, -46, -41, -36, -31,
|
||||
-27, -24, -21, -18, -16, -14, -12, -11, -9, -8, -7, -6, -6, -5, -4,
|
||||
-4, -3, -3, -3, -3, -2, -2, -2, -2, -2, -2, -2, -1, 0, 0,
|
||||
0, 0, 0, 0, 0};
|
||||
|
||||
static const struct effect_stream effects[] = {
|
||||
{
|
||||
/* CLICK */
|
||||
.effect_id = 0,
|
||||
.data = effect_2,
|
||||
.length = ARRAY_SIZE(effect_2),
|
||||
.play_rate_hz = 24000,
|
||||
},
|
||||
{
|
||||
/* CLICK */
|
||||
.effect_id = 0,
|
||||
.data = effect_2,
|
||||
.length = ARRAY_SIZE(effect_2),
|
||||
.play_rate_hz = 24000,
|
||||
},
|
||||
|
||||
{
|
||||
/* DOUBLE_CLICK */
|
||||
.effect_id = 1,
|
||||
.data = effect_1,
|
||||
.length = ARRAY_SIZE(effect_1),
|
||||
.play_rate_hz = 24000,
|
||||
},
|
||||
{
|
||||
/* DOUBLE_CLICK */
|
||||
.effect_id = 1,
|
||||
.data = effect_1,
|
||||
.length = ARRAY_SIZE(effect_1),
|
||||
.play_rate_hz = 24000,
|
||||
},
|
||||
|
||||
{
|
||||
/* TICK */
|
||||
.effect_id = 2,
|
||||
.data = effect_2,
|
||||
.length = ARRAY_SIZE(effect_2),
|
||||
.play_rate_hz = 24000,
|
||||
},
|
||||
{
|
||||
/* TICK */
|
||||
.effect_id = 2,
|
||||
.data = effect_2,
|
||||
.length = ARRAY_SIZE(effect_2),
|
||||
.play_rate_hz = 24000,
|
||||
},
|
||||
|
||||
{
|
||||
/* THUD */
|
||||
.effect_id = 3,
|
||||
.data = effect_3,
|
||||
.length = ARRAY_SIZE(effect_3),
|
||||
.play_rate_hz = 24000,
|
||||
},
|
||||
{
|
||||
/* THUD */
|
||||
.effect_id = 3,
|
||||
.data = effect_3,
|
||||
.length = ARRAY_SIZE(effect_3),
|
||||
.play_rate_hz = 24000,
|
||||
},
|
||||
|
||||
{
|
||||
/* POP */
|
||||
.effect_id = 4,
|
||||
.data = effect_4,
|
||||
.length = ARRAY_SIZE(effect_4),
|
||||
.play_rate_hz = 24000,
|
||||
},
|
||||
{
|
||||
/* POP */
|
||||
.effect_id = 4,
|
||||
.data = effect_4,
|
||||
.length = ARRAY_SIZE(effect_4),
|
||||
.play_rate_hz = 24000,
|
||||
},
|
||||
|
||||
{
|
||||
/* HEAVY_CLICK */
|
||||
.effect_id = 5,
|
||||
.data = effect_3,
|
||||
.length = ARRAY_SIZE(effect_3),
|
||||
.play_rate_hz = 24000,
|
||||
},
|
||||
{
|
||||
/* HEAVY_CLICK */
|
||||
.effect_id = 5,
|
||||
.data = effect_3,
|
||||
.length = ARRAY_SIZE(effect_3),
|
||||
.play_rate_hz = 24000,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -32,12 +32,12 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
struct effect_stream {
|
||||
uint32_t effect_id;
|
||||
uint32_t length;
|
||||
uint32_t play_rate_hz;
|
||||
const int8_t *data;
|
||||
uint32_t effect_id;
|
||||
uint32_t length;
|
||||
uint32_t play_rate_hz;
|
||||
const int8_t* data;
|
||||
};
|
||||
|
||||
const struct effect_stream *get_effect_stream(uint32_t effect_id);
|
||||
const struct effect_stream* get_effect_stream(uint32_t effect_id);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,9 +37,9 @@ namespace hardware {
|
||||
namespace vibrator {
|
||||
|
||||
class InputFFDevice {
|
||||
public:
|
||||
public:
|
||||
InputFFDevice();
|
||||
int playEffect(int effectId, EffectStrength es, long *playLengthMs);
|
||||
int playEffect(int effectId, EffectStrength es, long* playLengthMs);
|
||||
int on(int32_t timeoutMs);
|
||||
int off();
|
||||
int setAmplitude(uint8_t amplitude);
|
||||
@@ -47,36 +47,37 @@ public:
|
||||
bool mSupportEffects;
|
||||
bool mSupportExternalControl;
|
||||
bool mInExternalControl;
|
||||
private:
|
||||
int play(int effectId, uint32_t timeoutMs, long *playLengthMs);
|
||||
|
||||
private:
|
||||
int play(int effectId, uint32_t timeoutMs, long* playLengthMs);
|
||||
int mVibraFd;
|
||||
int16_t mCurrAppId;
|
||||
int16_t mCurrMagnitude;
|
||||
};
|
||||
|
||||
class LedVibratorDevice {
|
||||
public:
|
||||
public:
|
||||
LedVibratorDevice();
|
||||
int on(int32_t timeoutMs);
|
||||
int onWaveform(int waveformIndex);
|
||||
int off();
|
||||
bool mDetected;
|
||||
int write_value(const char *file, const char *value);
|
||||
int write_value(const char *file, int value);
|
||||
int write_value(const char* file, const char* value);
|
||||
int write_value(const char* file, int value);
|
||||
};
|
||||
|
||||
class Vibrator : public BnVibrator {
|
||||
public:
|
||||
public:
|
||||
class InputFFDevice ff;
|
||||
class LedVibratorDevice ledVib;
|
||||
|
||||
ndk::ScopedAStatus getCapabilities(int32_t* _aidl_return) override;
|
||||
ndk::ScopedAStatus off() override;
|
||||
ndk::ScopedAStatus on(int32_t timeoutMs,
|
||||
const std::shared_ptr<IVibratorCallback>& callback) override;
|
||||
const std::shared_ptr<IVibratorCallback>& callback) override;
|
||||
ndk::ScopedAStatus perform(Effect effect, EffectStrength strength,
|
||||
const std::shared_ptr<IVibratorCallback>& callback,
|
||||
int32_t* _aidl_return) override;
|
||||
const std::shared_ptr<IVibratorCallback>& callback,
|
||||
int32_t* _aidl_return) override;
|
||||
ndk::ScopedAStatus getSupportedEffects(std::vector<Effect>* _aidl_return) override;
|
||||
ndk::ScopedAStatus setAmplitude(float amplitude) override;
|
||||
ndk::ScopedAStatus setExternalControl(bool enabled) override;
|
||||
|
||||
@@ -143,7 +143,7 @@ ndk::ScopedAStatus Vibrator::getCompositionSizeMax(int32_t* maxSize __unused) {
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus Vibrator::getSupportedPrimitives(
|
||||
std::vector<CompositePrimitive>* supported __unused) {
|
||||
std::vector<CompositePrimitive>* supported __unused) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
@@ -157,7 +157,8 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect>& composi
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus Vibrator::getSupportedAlwaysOnEffects(std::vector<Effect>* _aidl_return __unused) {
|
||||
ndk::ScopedAStatus Vibrator::getSupportedAlwaysOnEffects(
|
||||
std::vector<Effect>* _aidl_return __unused) {
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
|
||||
}
|
||||
|
||||
@@ -203,7 +204,8 @@ ndk::ScopedAStatus Vibrator::getSupportedBraking(std::vector<Braking>* supported
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus Vibrator::composePwle(const std::vector<PrimitivePwle>& composite __unused,
|
||||
const std::shared_ptr<IVibratorCallback>& callback __unused) {
|
||||
const std::shared_ptr<IVibratorCallback>& callback
|
||||
__unused) {
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
#define LOG_TAG "audio_amplifier"
|
||||
//#define LOG_NDEBUG 0
|
||||
// #define LOG_NDEBUG 0
|
||||
|
||||
#include <cutils/str_parms.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
@@ -15,6 +15,8 @@ android_app {
|
||||
],
|
||||
|
||||
optimize: {
|
||||
optimize: true,
|
||||
proguard_flags_files: ["proguard.flags"],
|
||||
shrink_resources: true,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
-->
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
|
||||
android:title="@string/ambient_display_title">
|
||||
|
||||
@@ -44,10 +45,10 @@
|
||||
android:key="gesture_pick_up_type"
|
||||
android:defaultValue="0"
|
||||
android:icon="@drawable/ic_pickup"
|
||||
android:title="@string/pick_up_gesture_title"
|
||||
android:summary="%s"
|
||||
android:entries="@array/pick_up_gesture_entries"
|
||||
android:entryValues="@array/pick_up_gesture_values" />
|
||||
android:entryValues="@array/pick_up_gesture_values"
|
||||
android:title="@string/pick_up_gesture_title"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
@@ -17,27 +17,30 @@ class DozeService : Service() {
|
||||
private lateinit var pickupSensor: PickupSensor
|
||||
private lateinit var pocketSensor: PocketSensor
|
||||
|
||||
private val screenStateReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
when (intent.action) {
|
||||
Intent.ACTION_SCREEN_ON -> onDisplayOn()
|
||||
Intent.ACTION_SCREEN_OFF -> onDisplayOff()
|
||||
private val screenStateReceiver =
|
||||
object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
when (intent.action) {
|
||||
Intent.ACTION_SCREEN_ON -> onDisplayOn()
|
||||
Intent.ACTION_SCREEN_OFF -> onDisplayOff()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate() {
|
||||
Log.d(TAG, "Creating service")
|
||||
pickupSensor = PickupSensor(
|
||||
this,
|
||||
resources.getString(R.string.pickup_sensor_type),
|
||||
resources.getFloat(R.dimen.pickup_sensor_value),
|
||||
)
|
||||
pocketSensor = PocketSensor(
|
||||
this,
|
||||
resources.getString(R.string.pocket_sensor_type),
|
||||
resources.getFloat(R.dimen.pocket_sensor_value)
|
||||
)
|
||||
pickupSensor =
|
||||
PickupSensor(
|
||||
this,
|
||||
resources.getString(R.string.pickup_sensor_type),
|
||||
resources.getFloat(R.dimen.pickup_sensor_value),
|
||||
)
|
||||
pocketSensor =
|
||||
PocketSensor(
|
||||
this,
|
||||
resources.getString(R.string.pocket_sensor_type),
|
||||
resources.getFloat(R.dimen.pocket_sensor_value),
|
||||
)
|
||||
|
||||
val screenStateFilter = IntentFilter()
|
||||
screenStateFilter.addAction(Intent.ACTION_SCREEN_ON)
|
||||
|
||||
@@ -16,8 +16,9 @@ class DozeSettingsActivity : CollapsingToolbarBaseActivity() {
|
||||
.replace(
|
||||
com.android.settingslib.collapsingtoolbar.R.id.content_frame,
|
||||
DozeSettingsFragment(),
|
||||
TAG
|
||||
).commit()
|
||||
TAG,
|
||||
)
|
||||
.commit()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
package org.lineageos.settings.doze
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.AlertDialog
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
@@ -104,5 +103,4 @@ class DozeSettingsFragment : PreferenceFragmentCompat(), Preference.OnPreference
|
||||
handler.post { Utils.checkDozeService(requireContext()) }
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,11 +14,12 @@ import android.os.PowerManager
|
||||
import android.os.SystemClock
|
||||
import android.util.Log
|
||||
import android.view.Display
|
||||
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
class PickupSensor(
|
||||
private val context: Context, sensorType: String, private val sensorValue: Float
|
||||
private val context: Context,
|
||||
sensorType: String,
|
||||
private val sensorValue: Float,
|
||||
) : SensorEventListener {
|
||||
private val powerManager = context.getSystemService(PowerManager::class.java)!!
|
||||
private val wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG)
|
||||
@@ -43,7 +44,7 @@ class PickupSensor(
|
||||
SystemClock.uptimeMillis(),
|
||||
PowerManager.WAKE_REASON_GESTURE,
|
||||
TAG,
|
||||
Display.DEFAULT_DISPLAY
|
||||
Display.DEFAULT_DISPLAY,
|
||||
)
|
||||
} else {
|
||||
Utils.launchDozePulse(context)
|
||||
@@ -61,15 +62,12 @@ class PickupSensor(
|
||||
sensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_NORMAL)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun disable() {
|
||||
if (sensor != null) {
|
||||
Log.d(TAG, "Disabling")
|
||||
executorService.submit {
|
||||
sensorManager.unregisterListener(this, sensor)
|
||||
}
|
||||
executorService.submit { sensorManager.unregisterListener(this, sensor) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,11 +12,12 @@ import android.hardware.SensorEventListener
|
||||
import android.hardware.SensorManager
|
||||
import android.os.SystemClock
|
||||
import android.util.Log
|
||||
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
class PocketSensor(
|
||||
private val context: Context, sensorType: String, private val sensorValue: Float
|
||||
private val context: Context,
|
||||
sensorType: String,
|
||||
private val sensorValue: Float,
|
||||
) : SensorEventListener {
|
||||
private val sensorManager = context.getSystemService(SensorManager::class.java)!!
|
||||
private val sensor = Utils.getSensor(sensorManager, sensorType)
|
||||
@@ -51,9 +52,7 @@ class PocketSensor(
|
||||
fun disable() {
|
||||
if (sensor != null) {
|
||||
Log.d(TAG, "Disabling")
|
||||
executorService.submit {
|
||||
sensorManager.unregisterListener(this, sensor)
|
||||
}
|
||||
executorService.submit { sensorManager.unregisterListener(this, sensor) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,13 +64,19 @@ object Utils {
|
||||
|
||||
fun enableAlwaysOn(context: Context, enable: Boolean): Boolean {
|
||||
return Settings.Secure.putIntForUser(
|
||||
context.contentResolver, DOZE_ALWAYS_ON, if (enable) 1 else 0, UserHandle.USER_CURRENT
|
||||
context.contentResolver,
|
||||
DOZE_ALWAYS_ON,
|
||||
if (enable) 1 else 0,
|
||||
UserHandle.USER_CURRENT,
|
||||
)
|
||||
}
|
||||
|
||||
fun isAlwaysOnEnabled(context: Context): Boolean {
|
||||
return Settings.Secure.getIntForUser(
|
||||
context.contentResolver, DOZE_ALWAYS_ON, 0, UserHandle.USER_CURRENT
|
||||
context.contentResolver,
|
||||
DOZE_ALWAYS_ON,
|
||||
0,
|
||||
UserHandle.USER_CURRENT,
|
||||
) != 0
|
||||
}
|
||||
|
||||
@@ -79,8 +85,7 @@ object Utils {
|
||||
}
|
||||
|
||||
private fun isGestureEnabled(context: Context, gesture: String?): Boolean {
|
||||
return PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.getBoolean(gesture, false)
|
||||
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(gesture, false)
|
||||
}
|
||||
|
||||
fun isPickUpEnabled(context: Context): Boolean {
|
||||
|
||||
@@ -25,6 +25,8 @@ android_app {
|
||||
],
|
||||
|
||||
optimize: {
|
||||
optimize: true,
|
||||
proguard_flags_files: ["proguard.flags"],
|
||||
shrink_resources: true,
|
||||
},
|
||||
}
|
||||
|
||||
13
eSimSwitcher/res/values-es/strings.xml
Normal file
13
eSimSwitcher/res/values-es/strings.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2025 The LineageOS Project
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<resources>
|
||||
<string name="esim_settings_title">Configuración de eSIM</string>
|
||||
<string name="esim_toggle_title">eSIM</string>
|
||||
<string name="esim_toggle_summary">Descarga y activa un perfil de operador para usar una tarjeta SIM virtual.</string>
|
||||
<string name="esim_toggle_dialog">La SIM 2 se desactivará si activas la eSIM. ¿Quieres activarla de todas formas?</string>
|
||||
<string name="esim_toggle_dialog_cancel">Cancelar</string>
|
||||
<string name="esim_toggle_dialog_ok">Activar</string>
|
||||
</resources>
|
||||
13
eSimSwitcher/res/values-iw/strings.xml
Normal file
13
eSimSwitcher/res/values-iw/strings.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2025 The LineageOS Project
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<resources>
|
||||
<string name="esim_settings_title">הגדרות eSIM</string>
|
||||
<string name="esim_toggle_title">eSIM</string>
|
||||
<string name="esim_toggle_summary">יש להוריד ולהפעיל את פרופיל ההפעלה כדי להשתמש בסים וירטואלי</string>
|
||||
<string name="esim_toggle_dialog">סים 2 יושבת אם יופעל eSIM. להפעיל בכל זאת?</string>
|
||||
<string name="esim_toggle_dialog_cancel">ביטול</string>
|
||||
<string name="esim_toggle_dialog_ok">הפעלה</string>
|
||||
</resources>
|
||||
13
eSimSwitcher/res/values-sc-rIT/strings.xml
Normal file
13
eSimSwitcher/res/values-sc-rIT/strings.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2025 The LineageOS Project
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<resources>
|
||||
<string name="esim_settings_title">Cunfiguratziones eSIM</string>
|
||||
<string name="esim_toggle_title">eSIM</string>
|
||||
<string name="esim_toggle_summary">Iscàrriga e ativa unu profilu de operadore pro impreare un\'ischeda SIM virtuale</string>
|
||||
<string name="esim_toggle_dialog">Sa SIM 2 at a èssere disativada si ativas s\'eSIM. Dda boles abilitare su pròpiu?</string>
|
||||
<string name="esim_toggle_dialog_cancel">Annulla</string>
|
||||
<string name="esim_toggle_dialog_ok">Abilita</string>
|
||||
</resources>
|
||||
@@ -16,9 +16,10 @@ class BootCompletedReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
Log.d(TAG, "Received boot completed intent")
|
||||
|
||||
val hasNonRemovableEuicc = context.resources.getIntArray(
|
||||
com.android.internal.R.array.non_removable_euicc_slots
|
||||
).isNotEmpty()
|
||||
val hasNonRemovableEuicc =
|
||||
context.resources
|
||||
.getIntArray(com.android.internal.R.array.non_removable_euicc_slots)
|
||||
.isNotEmpty()
|
||||
|
||||
setComponentEnabled(context, EsimSettingsActivity::class.java.name, hasNonRemovableEuicc)
|
||||
}
|
||||
@@ -26,11 +27,12 @@ class BootCompletedReceiver : BroadcastReceiver() {
|
||||
private fun setComponentEnabled(context: Context, component: String, enabled: Boolean) {
|
||||
val name = ComponentName(context, component)
|
||||
val pm = context.packageManager
|
||||
val newState = if (enabled) {
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED
|
||||
} else {
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED
|
||||
}
|
||||
val newState =
|
||||
if (enabled) {
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED
|
||||
} else {
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED
|
||||
}
|
||||
|
||||
if (pm.getComponentEnabledSetting(name) != newState) {
|
||||
pm.setComponentEnabledSetting(name, newState, PackageManager.DONT_KILL_APP)
|
||||
|
||||
@@ -8,13 +8,10 @@ package org.lineageos.settings.esimswitcher
|
||||
import android.content.Context
|
||||
import android.os.ServiceManager
|
||||
import android.os.SystemProperties
|
||||
import android.se.omapi.Channel
|
||||
import android.se.omapi.Reader
|
||||
import android.se.omapi.SEService
|
||||
import android.se.omapi.Session
|
||||
import android.util.Log
|
||||
import kotlinx.coroutines.asExecutor
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.asExecutor
|
||||
import vendor.oplus.hardware.esim.IOplusEsim
|
||||
|
||||
class EsimController(private val context: Context) {
|
||||
@@ -49,33 +46,34 @@ class EsimController(private val context: Context) {
|
||||
private fun specialSetEsimGpio(state: Int) {
|
||||
var seService: SEService? = null
|
||||
|
||||
val listener = object : SEService.OnConnectedListener {
|
||||
override fun onConnected() {
|
||||
Log.d(TAG, "SEService connected")
|
||||
val listener =
|
||||
object : SEService.OnConnectedListener {
|
||||
override fun onConnected() {
|
||||
Log.d(TAG, "SEService connected")
|
||||
|
||||
val service = seService ?: return
|
||||
val service = seService ?: return
|
||||
|
||||
try {
|
||||
val reader = service.readers.firstOrNull { it.name == "eSE1" }
|
||||
val session = reader?.openSession()
|
||||
val channel = session?.openLogicalChannel(null)
|
||||
|
||||
oplusEsimService?.setEsimGpio(state)
|
||||
oplusEsimService?.setUimPower(1)
|
||||
|
||||
channel?.close()
|
||||
session?.close()
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Failed to open eSE session", e)
|
||||
} finally {
|
||||
try {
|
||||
service.shutdown()
|
||||
val reader = service.readers.firstOrNull { it.name == "eSE1" }
|
||||
val session = reader?.openSession()
|
||||
val channel = session?.openLogicalChannel(null)
|
||||
|
||||
oplusEsimService?.setEsimGpio(state)
|
||||
oplusEsimService?.setUimPower(1)
|
||||
|
||||
channel?.close()
|
||||
session?.close()
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Failed to shutdown SEService", e)
|
||||
Log.e(TAG, "Failed to open eSE session", e)
|
||||
} finally {
|
||||
try {
|
||||
service.shutdown()
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Failed to shutdown SEService", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
seService = SEService(context, Dispatchers.IO.asExecutor(), listener)
|
||||
|
||||
@@ -16,8 +16,9 @@ class EsimSettingsActivity : CollapsingToolbarBaseActivity() {
|
||||
.replace(
|
||||
com.android.settingslib.collapsingtoolbar.R.id.content_frame,
|
||||
EsimSettingsFragment(),
|
||||
TAG
|
||||
).commit()
|
||||
TAG,
|
||||
)
|
||||
.commit()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -10,7 +10,6 @@ import android.os.Bundle
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import androidx.preference.SwitchPreferenceCompat
|
||||
import org.lineageos.settings.esimswitcher.R
|
||||
|
||||
class EsimSettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChangeListener {
|
||||
private lateinit var controller: EsimController
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 The LineageOS Project
|
||||
* SPDX-FileCopyrightText: 2025-2026 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
@@ -19,6 +19,7 @@ using android::base::ParseInt;
|
||||
using android::base::Tokenize;
|
||||
|
||||
using aidl::android::hardware::biometrics::fingerprint::FingerprintSensorType;
|
||||
using aidl::android::hardware::biometrics::fingerprint::SensorLocation;
|
||||
using aidl::android::hardware::biometrics::fingerprint::SensorProps;
|
||||
|
||||
namespace {
|
||||
@@ -37,23 +38,36 @@ SensorProps SensorPropsInit(SensorProps props) {
|
||||
props.sensorType = FingerprintSensorType::HOME_BUTTON;
|
||||
}
|
||||
|
||||
auto loc_prop = GetProperty("persist.vendor.fingerprint.optical.sensorlocation", "");
|
||||
auto loc_prop = GetProperty("persist.vendor.fingerprint.optical.sensorlocation",
|
||||
GetProperty("persist.vendor.fingerprint.side.sensorlocation", ""));
|
||||
if (!loc_prop.empty()) {
|
||||
auto loc = Tokenize(loc_prop, ":");
|
||||
bool loc_parsed = false;
|
||||
if (loc.size() >= 2) {
|
||||
int32_t x, y;
|
||||
loc_parsed = ParseInt(loc[0], &x) && ParseInt(loc[1], &y);
|
||||
if (loc_parsed) {
|
||||
props.sensorLocations[0].sensorLocationX = x;
|
||||
props.sensorLocations[0].sensorLocationY = y;
|
||||
auto locations = Tokenize(loc_prop, "|");
|
||||
props.sensorLocations.clear();
|
||||
|
||||
for (const auto& location : locations) {
|
||||
auto parts = Tokenize(location, "::");
|
||||
bool loc_parsed = false;
|
||||
if (parts.size() >= 2) {
|
||||
int32_t x, y;
|
||||
loc_parsed = ParseInt(parts[0], &x) && ParseInt(parts[1], &y);
|
||||
if (loc_parsed) {
|
||||
SensorLocation loc;
|
||||
loc.sensorLocationX = x;
|
||||
loc.sensorLocationY = y;
|
||||
if (parts.size() >= 3 && !parts[2].empty()) {
|
||||
loc.display = "local:" + parts[2];
|
||||
}
|
||||
|
||||
props.sensorLocations.push_back(loc);
|
||||
}
|
||||
}
|
||||
LOG_IF(WARNING, !loc_parsed)
|
||||
<< "Invalid sensor location input (x::y[::display]): " << location;
|
||||
}
|
||||
LOG_IF(WARNING, !loc_parsed) << "Invalid sensor location input (x::y): " << loc_prop;
|
||||
}
|
||||
|
||||
auto size = GetProperty("persist.vendor.fingerprint.optical.iconsize", "");
|
||||
if (!size.empty()) {
|
||||
if (!size.empty() && !props.sensorLocations.empty()) {
|
||||
if (ParseInt(size, &props.sensorLocations[0].sensorRadius)) {
|
||||
props.sensorLocations[0].sensorRadius /= 2;
|
||||
} else {
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace implementation {
|
||||
|
||||
class ISensorsEventCallback {
|
||||
public:
|
||||
virtual ~ISensorsEventCallback(){};
|
||||
virtual ~ISensorsEventCallback() {};
|
||||
virtual void postEvents(const std::vector<Event>& events, bool wakeup) = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -5,3 +5,5 @@ hal_client_domain(esim_switcher_app, vendor_hal_oplus_esim)
|
||||
hal_client_domain(esim_switcher_app, vendor_hal_qspmhal)
|
||||
|
||||
allow esim_switcher_app app_api_service:service_manager find;
|
||||
|
||||
get_prop(esim_switcher_app, vendor_persist_nfc_prop)
|
||||
|
||||
@@ -74,9 +74,6 @@ persist.sys.log. u:object_r:exported_system_prop:s0
|
||||
# Modem
|
||||
persist.sys.enable_modem_dump u:object_r:exported_system_prop:s0
|
||||
|
||||
# NFC
|
||||
persist.vendor.nfc.config_file_name u:object_r:vendor_public_vendor_default_prop:s0
|
||||
|
||||
# Performance
|
||||
sys.oplus.high.performance u:object_r:exported_system_prop:s0
|
||||
|
||||
@@ -88,6 +85,9 @@ ro.sys.reserve.integrate u:object_r:exported_system_prop:s0
|
||||
sys.oplus_boot_mode u:object_r:exported_system_prop:s0
|
||||
sys.oplus.radio. u:object_r:system_oplus_radio_prop:s0
|
||||
|
||||
# Secure Element
|
||||
ro.oplus.normal_boot_mode u:object_r:exported_system_prop:s0
|
||||
|
||||
# SVN
|
||||
ro.build.version.ota u:object_r:exported_system_prop:s0
|
||||
ro.build.version.svn u:object_r:exported_system_prop:s0
|
||||
|
||||
5
sepolicy/qti/vendor/file_contexts
vendored
5
sepolicy/qti/vendor/file_contexts
vendored
@@ -250,8 +250,9 @@
|
||||
/mnt/vendor/oplusreserve/system/ssv(/.*)? u:object_r:oplus_reserve_system_ssv:s0
|
||||
|
||||
# Secure Element
|
||||
/(odm|vendor/odm)/bin/hw/android\.hardware\.secure_element-service\.qti u:object_r:hal_secure_element_default_exec:s0
|
||||
/(odm|vendor/odm)/bin/hw/vendor\.qti\.secure_element@1\.2-service u:object_r:hal_secure_element_default_exec:s0
|
||||
/(odm|vendor/odm)/bin/hw/android\.hardware\.secure_element@1\.2-service-goodix u:object_r:hal_secure_element_default_exec:s0
|
||||
/(odm|vendor/odm)/bin/hw/android\.hardware\.secure_element-service\.qti u:object_r:hal_secure_element_default_exec:s0
|
||||
/(odm|vendor/odm)/bin/hw/vendor\.qti\.secure_element@1\.2-service u:object_r:hal_secure_element_default_exec:s0
|
||||
|
||||
# Sensors
|
||||
/(odm|vendor/odm)/bin/hw/vendor-oplus-hardware-oplusSensor-V1-service u:object_r:hal_oplus_sensor_aidl_exec:s0
|
||||
|
||||
14
sepolicy/qti/vendor/genfs_contexts
vendored
14
sepolicy/qti/vendor/genfs_contexts
vendored
@@ -120,6 +120,7 @@ genfscon sysfs /devices/platform/soc/8c0000.qcom,qupv3_2_geni_se/880000.qcom,qup
|
||||
genfscon sysfs /devices/platform/soc/8c0000.qcom,qupv3_2_geni_se/884000.i2c/i2c-7/7-0010/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/8c0000.qcom,qupv3_2_geni_se/884000.i2c/i2c-8/8-0010/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/8c0000.qcom,qupv3_2_geni_se/884000.i2c/i2c-9/9-0010/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/8c0000.qcom,qupv3_2_geni_se/888000.spi/spi_master/spi1/spi1.0/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/8c0000.qcom,qupv3_2_geni_se/89c000.qcom,qup_uart/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/980000.i2c/i2c-0/0-003b/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/980000.i2c/i2c-7/7-003b/wakeup u:object_r:sysfs_wakeup:s0
|
||||
@@ -135,12 +136,16 @@ genfscon sysfs /devices/platform/soc/994000.i2c/i2c-5/5-003b/994000.i2c:op,wlchg
|
||||
genfscon sysfs /devices/platform/soc/994000.i2c/i2c-5/5-0066/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/994000.i2c/i2c-8/8-003b/994000.i2c:op,wlchg_rx@3b:idt,p9415/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/994000.i2c/i2c-8/8-0066/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/9c0000.qcom,qupv3_i2c_geni_se/988000.i2c/i2c-5/5-006a/ufcs/ufcs/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/9c0000.qcom,qupv3_i2c_geni_se/988000.i2c/i2c-5/5-006a/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/9c0000.qcom,qupv3_i2c_geni_se/988000.i2c/i2c-9/9-006f/ufcs/ufcs/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/9c0000.qcom,qupv3_i2c_geni_se/988000.i2c/i2c-9/9-006f/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/9c0000.qcom,qupv3_i2c_geni_se/98c000.i2c/i2c-5/5-003b/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/9c0000.qcom,qupv3_i2c_geni_se/98c000.i2c/i2c-6/6-0036/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/9c0000.qcom,qupv3_i2c_geni_se/990000.i2c/i2c-6/6-006a/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/9c0000.qcom,qupv3_i2c_geni_se/9a0000.i2c/i2c-14/14-006f/ufcs/ufcs/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/9c0000.qcom,qupv3_i2c_geni_se/9a0000.i2c/i2c-14/14-006f/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/9c0000.qcom,qupv3_i2c_geni_se/9a0000.i2c/i2c-7/7-0010/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/9c0000.qcom,qupv3_i2c_geni_se/9a0000.i2c/i2c-8/8-0010/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/9c0000.qcom,qupv3_i2c_geni_se/9a4000.i2c/i2c-7/7-0010/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/a600000.ssusb/a600000.dwc3/wakeup u:object_r:sysfs_wakeup:s0
|
||||
@@ -153,9 +158,8 @@ genfscon sysfs /devices/platform/soc/a94000.i2c/i2c-2/2-0038/wakeup u:object_r:s
|
||||
genfscon sysfs /devices/platform/soc/a94000.i2c/i2c-9/9-0048/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/a94000.i2c/i2c-9/9-004b/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/a94000.spi/spi_master/spi1/spi1.0/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/aab0000.qcom,venus/subsys10/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/aab0000.qcom,venus/subsys9/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/ac0000.qcom,qupv3_0_geni_se/a80000.i2c/i2c-4/4-0010/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/ac0000.qcom,qupv3_0_geni_se/a84000.i2c/i2c-5/5-006f/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/ac0000.qcom,qupv3_0_geni_se/a90000.spi/spi_master/spi0/spi0.0/synaptics_tcm_hbp.0/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/ac0000.qcom,qupv3_1_geni_se/a80000.i2c/i2c-10/10-0028/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/ac0000.qcom,qupv3_1_geni_se/a80000.i2c/i2c-11/11-0028/wakeup u:object_r:sysfs_wakeup:s0
|
||||
@@ -174,21 +178,19 @@ genfscon sysfs /devices/platform/soc/ac0000.qcom,qupv3_1_geni_se/a90000.spi/spi_
|
||||
genfscon sysfs /devices/platform/soc/ac0000.qcom,qupv3_1_geni_se/a90000.spi/spi_master/spi0/spi0.0/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/ac0000.qcom,qupv3_1_geni_se/a90000.spi/spi_master/spi1/spi1.0/synaptics_tcm_hbp.0/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/ac0000.qcom,qupv3_1_geni_se/a9c000.qcom,qup_uart/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/b0000000.qcom,cnss-qca6490/subsys10/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/b0000000.qcom,cnss-qca6490/subsys9/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/c42d000.qcom,spmi/spmi-0/0-00/c42d000.qcom,spmi:qcom,pmk8350@0:pon_pbs@800/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/c42d000.qcom,spmi/spmi-0/0-00/c42d000.qcom,spmi:qcom,pmk8550@0:pon_hlos@1300/c42d000.qcom,spmi:qcom,pmk8550@0:pon_hlos@1300:pwrkey-resin/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/c42d000.qcom,spmi/spmi-0/0-00/c42d000.qcom,spmi:qcom,pmk8550@0:pon_pbs@800/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/ac/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm8150b@2:qcom,qpnp-smb5/power_supply/ac/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm8150b@2:qcom,usb-pdphy@1700/usbpd/usbpd0/otg_default/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-03/c440000.qcom,spmi:qcom,pm8350b@3:qcom,amoled/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/c80000.i2c/i2c-5/5-0020/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/c80000.i2c/i2c-5/5-0048/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:discrete_charger/power_supply/ac/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:discrete_charger/power_supply/battery/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:discrete_charger/power_supply/usb/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:discrete_charger/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:gpio-hall-sensor/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:oneplus_wlchg/power_supply/wireless/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:oneplus_wlchg/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:oplus,chg_gki/power_supply/battery/wakeup u:object_r:sysfs_wakeup:s0
|
||||
@@ -204,8 +206,8 @@ genfscon sysfs /devices/platform/soc/soc:oplus,chg_intf/soc:oplus,chg_intf:oplus
|
||||
genfscon sysfs /devices/platform/soc/soc:oplus,chg_wls/oplus_mms/wireless/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:oplus,chg_wls/oplus_mms/wireless/wireless/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:oplus,chg_wls/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:oplus,common-charge/common/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:oplus,comm/oplus_mms/common/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:oplus,common-charge/common/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:oplus,cpa/oplus_mms/cpa/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:oplus,mms_gauge/oplus_mms/gauge/battery/power/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:oplus,mms_gauge/oplus_mms/gauge/battery/wakeup u:object_r:sysfs_wakeup:s0
|
||||
|
||||
@@ -5,11 +5,15 @@ type hal_oplus_charger_aidl_exec, exec_type, vendor_file_type, file_type;
|
||||
init_daemon_domain(hal_oplus_charger_aidl)
|
||||
|
||||
binder_call(vendor_hal_oplus_charger_client, vendor_hal_oplus_charger_server)
|
||||
binder_call(vendor_hal_oplus_charger_server, vendor_hal_oplus_charger_client)
|
||||
|
||||
hal_client_domain(system_server, vendor_hal_oplus_charger)
|
||||
hal_server_domain(hal_oplus_charger_aidl, vendor_hal_oplus_charger)
|
||||
|
||||
hal_attribute_service(vendor_hal_oplus_charger, hal_oplus_charger_aidl_service)
|
||||
|
||||
allow hal_oplus_charger_aidl fwk_sensor_hwservice:hwservice_manager find;
|
||||
|
||||
allow hal_oplus_charger_aidl self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl;
|
||||
|
||||
allow hal_oplus_charger_aidl oplus_charger_device:chr_file rw_file_perms;
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
add_service(hal_secure_element_default, hal_secure_element_extend_service)
|
||||
|
||||
hal_client_domain(hal_secure_element_default, vendor_hal_oplus_commondcs)
|
||||
|
||||
allow hal_secure_element_default nfc_device:chr_file rw_file_perms;
|
||||
|
||||
set_prop(hal_secure_element_default, vendor_oplus_se_prop)
|
||||
|
||||
12
sepolicy/qti/vendor/legacy-um/genfs_contexts
vendored
12
sepolicy/qti/vendor/legacy-um/genfs_contexts
vendored
@@ -1,14 +1,2 @@
|
||||
# Wakeup (https://lkml.org/lkml/2019/8/6/1275)
|
||||
genfscon sysfs /devices/platform/soc/17300000.qcom,lpass/subsys6/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/188101c.qcom,spss/subsys5/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/4080000.qcom,mss/subsys8/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/5c00000.qcom,ssc/subsys7/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/890000.qcom,qup_uart/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/98900000.qcom,turing/subsys4/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/98900000.qcom,turing/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/990000.i2c/i2c-9/9-004b/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/abb0000.qcom,evass/subsys1/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/abb0000.qcom,evass/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:qcom,ipa_fws/subsys0/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys3/wakeup u:object_r:sysfs_wakeup:s0
|
||||
genfscon sysfs /devices/platform/soc/soc:qcom,trustedvm@d0800000/subsys2/wakeup u:object_r:sysfs_wakeup:s0
|
||||
|
||||
3
sepolicy/qti/vendor/property.te
vendored
3
sepolicy/qti/vendor/property.te
vendored
@@ -13,6 +13,9 @@ vendor_internal_prop(vendor_modem_prop)
|
||||
# RIL
|
||||
vendor_internal_prop(vendor_nw_exported_system_prop)
|
||||
|
||||
# Secure Element
|
||||
vendor_internal_prop(vendor_oplus_se_prop)
|
||||
|
||||
# Thermal
|
||||
vendor_internal_prop(vendor_thermal_engine_prop)
|
||||
|
||||
|
||||
3
sepolicy/qti/vendor/property_contexts
vendored
3
sepolicy/qti/vendor/property_contexts
vendored
@@ -44,6 +44,9 @@ vendor.oplus.radio. u:object_r:vendor_radio_prop:s0
|
||||
vendor.gsm.phoneserial u:object_r:vendor_nw_exported_system_prop:s0
|
||||
vendor.gsm.serial u:object_r:vendor_nw_exported_system_prop:s0
|
||||
|
||||
# Secure Element
|
||||
vendor.oplus.secure_element. u:object_r:vendor_oplus_se_prop:s0
|
||||
|
||||
# Sensors
|
||||
ro.vendor.oplus.sensor. u:object_r:vendor_sensors_prop:s0
|
||||
|
||||
|
||||
3
sepolicy/qti/vendor/service.te
vendored
3
sepolicy/qti/vendor/service.te
vendored
@@ -45,6 +45,9 @@ type hal_oplus_pogo_keyboard_aidl_service, hal_service_type, service_manager_typ
|
||||
# Project
|
||||
type hal_oplus_project_aidl_service, hal_service_type, service_manager_type;
|
||||
|
||||
# Secure Element
|
||||
type hal_secure_element_extend_service, hal_service_type, service_manager_type;
|
||||
|
||||
# Sensors
|
||||
type hal_oplus_sensor_aidl_service, hal_service_type, service_manager_type;
|
||||
|
||||
|
||||
3
sepolicy/qti/vendor/service_contexts
vendored
3
sepolicy/qti/vendor/service_contexts
vendored
@@ -59,6 +59,9 @@ vendor.oplus.hardware.ims.IImsStable/OplusImsRadio1 u:object_r:
|
||||
vendor.oplus.hardware.radio.IRadioStable/OplusRadio0 u:object_r:hal_radio_service:s0
|
||||
vendor.oplus.hardware.radio.IRadioStable/OplusRadio1 u:object_r:hal_radio_service:s0
|
||||
|
||||
# Secure Element
|
||||
vendor.oplus.hardware.secure_element.ISecureElement/default u:object_r:hal_secure_element_extend_service:s0
|
||||
|
||||
# Sensors
|
||||
vendor.oplus.hardware.oplusSensor.ISensorFeature/default u:object_r:hal_oplus_sensor_aidl_service:s0
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
</hal>
|
||||
<hal format="aidl" optional="true">
|
||||
<name>vendor.oplus.hardware.cwb</name>
|
||||
<version>1</version>
|
||||
<version>1-2</version>
|
||||
<interface>
|
||||
<name>ICwbService</name>
|
||||
<instance>default</instance>
|
||||
@@ -138,6 +138,14 @@
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="aidl" optional="true">
|
||||
<name>vendor.oplus.hardware.display.MixLut3D</name>
|
||||
<version>1</version>
|
||||
<interface>
|
||||
<name>IMixLut3D</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="aidl" optional="true">
|
||||
<name>vendor.oplus.hardware.displaycolorfeature</name>
|
||||
<version>1</version>
|
||||
@@ -270,6 +278,14 @@
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="aidl" optional="true">
|
||||
<name>vendor.oplus.hardware.secure_element</name>
|
||||
<version>1</version>
|
||||
<interface>
|
||||
<name>ISecureElement</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="aidl" optional="true">
|
||||
<name>vendor.oplus.hardware.sendextcamcmd</name>
|
||||
<version>1-2</version>
|
||||
@@ -368,4 +384,12 @@
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl" optional="true">
|
||||
<name>vendor.zeku.hardware.explorer</name>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IMmsProvider</name>
|
||||
<instance>mms/explorer</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</compatibility-matrix>
|
||||
|
||||
Reference in New Issue
Block a user