Compare commits
61 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e6e67a60b | ||
|
|
ea228a83fe | ||
|
|
5af4457253 | ||
|
|
e73db17e01 | ||
|
|
48f0028833 | ||
|
|
644e3d1535 | ||
|
|
2f541dfbfc | ||
|
|
10cf15c402 | ||
|
|
0323f7b0e6 | ||
|
|
872e163ae9 | ||
|
|
bdf015820e | ||
|
|
5ff2752c40 | ||
|
|
8cb5e216a8 | ||
|
|
c3061b6b82 | ||
|
|
2407c73977 | ||
|
|
c12f2b7f19 | ||
|
|
fbb6973d74 | ||
|
|
4d300dc97e | ||
|
|
a8f7cfdf39 | ||
|
|
1e0db9dfa6 | ||
|
|
9854381e8a | ||
|
|
3808a4ae68 | ||
|
|
6b582cabb8 | ||
|
|
3c023d81a5 | ||
|
|
b84903b8ae | ||
|
|
8ed00feb62 | ||
|
|
aac59d1bb9 | ||
|
|
e2a08fae39 | ||
|
|
a55e7da413 | ||
|
|
9e64f1bfa4 | ||
|
|
ac49d682fc | ||
|
|
1c85c69ecd | ||
|
|
58fa6a7535 | ||
|
|
4ab4637909 | ||
|
|
a445c78924 | ||
|
|
fcb804fe98 | ||
|
|
3ca0074fef | ||
|
|
a43373294b | ||
|
|
d080d60171 | ||
|
|
ab8b987d02 | ||
|
|
1fdea7dc97 | ||
|
|
99c749a64c | ||
|
|
649443ae12 | ||
|
|
87ec3c12c3 | ||
|
|
beea2617ad | ||
|
|
d3353c6ab3 | ||
|
|
040e50155c | ||
|
|
91d15fa7af | ||
|
|
dbf0dc9428 | ||
|
|
2c14234077 | ||
|
|
f18dcb8e17 | ||
|
|
aae52ffce4 | ||
|
|
f677ebecd8 | ||
|
|
40ef19ab76 | ||
|
|
e400c781e8 | ||
|
|
b0a11aa8b4 | ||
|
|
5bb09cf6fa | ||
|
|
2eaa37731a | ||
|
|
04c945f5b3 | ||
|
|
15e7009f6f | ||
|
|
94a8ea7957 |
@@ -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,75 +0,0 @@
|
||||
//
|
||||
// Copyright (C) 2023 The LineageOS Project
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
android_app {
|
||||
name: "XiaomiEuicc",
|
||||
|
||||
srcs: ["src/**/*.kt"],
|
||||
resource_dirs: ["res"],
|
||||
|
||||
sdk_version: "current",
|
||||
product_specific: true,
|
||||
certificate: "platform",
|
||||
privileged: true,
|
||||
|
||||
optimize: {
|
||||
proguard_flags_files: ["proguard.flags"],
|
||||
},
|
||||
required: [
|
||||
"co.aospa.euicc.xml",
|
||||
"hidden-api-whitelist-co.aospa.euicc.xml",
|
||||
"EuiccGoogle",
|
||||
],
|
||||
}
|
||||
|
||||
android_app_import {
|
||||
name: "EuiccGoogle",
|
||||
owner: "xiaomi",
|
||||
apk: "proprietary/product/priv-app/EuiccGoogle/EuiccGoogle.apk",
|
||||
preprocessed: true,
|
||||
presigned: true,
|
||||
dex_preopt: {
|
||||
enabled: false,
|
||||
},
|
||||
privileged: true,
|
||||
product_specific: true,
|
||||
required: [
|
||||
"default-permissions-euicc.xml",
|
||||
"privapp-permissions-euiccgoogle.xml",
|
||||
],
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
sub_dir: "default-permissions",
|
||||
name: "default-permissions-euicc.xml",
|
||||
filename: "default-permissions-euicc.xml",
|
||||
src: "default-permissions-euicc.xml",
|
||||
product_specific: true,
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
sub_dir: "permissions",
|
||||
name: "privapp-permissions-euiccgoogle.xml",
|
||||
filename: "privapp-permissions-euiccgoogle.xml",
|
||||
src: "privapp-permissions-euiccgoogle.xml",
|
||||
product_specific: true,
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
sub_dir: "permissions",
|
||||
name: "co.aospa.euicc.xml",
|
||||
filename: "co.aospa.euicc.xml",
|
||||
src: "co.aospa.euicc.xml",
|
||||
product_specific: true,
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
sub_dir: "sysconfig",
|
||||
name: "hidden-api-whitelist-co.aospa.euicc.xml",
|
||||
filename: "hidden-api-whitelist-co.aospa.euicc.xml",
|
||||
src: "hidden-api-whitelist-co.aospa.euicc.xml",
|
||||
product_specific: true,
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023-2024 The LineageOS Project
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="co.aospa.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>
|
||||
</manifest>
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<permissions>
|
||||
<privapp-permissions package="co.aospa.euicc">
|
||||
<permission name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"/>
|
||||
<permission name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"/>
|
||||
</privapp-permissions>
|
||||
</permissions>
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
|
||||
|
||||
<!-- Copyright (C) 2019 Google Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!--
|
||||
This file contains permissions to be granted by default. Default
|
||||
permissions are granted to special platform components and to apps
|
||||
that are approved to get default grants. The special components
|
||||
are apps that are expected tto work out-of-the-box as they provide
|
||||
core use cases such as default dialer, default email, etc. These
|
||||
grants are managed by the platform. The apps that are additionally
|
||||
approved for default grants are ones that provide carrier specific
|
||||
functionality, ones legally required at some location, ones providing
|
||||
alternative disclosure and opt-out UI, ones providing highlight features
|
||||
of a dedicated device, etc. This file contains only the latter exceptions.
|
||||
Fixed permissions cannot be controlled by the user and need a special
|
||||
approval. Typically these are to ensure either legally mandated functions
|
||||
or the app is considered a part of the OS.
|
||||
-->
|
||||
|
||||
<exceptions>
|
||||
<exception
|
||||
package="com.google.android.euicc">
|
||||
<!-- Notifications -->
|
||||
<permission name="android.permission.POST_NOTIFICATIONS" fixed="false"/>
|
||||
</exception>
|
||||
</exceptions>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<config>
|
||||
<hidden-api-whitelisted-app package="co.aospa.euicc" />
|
||||
</config>
|
||||
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<permissions>
|
||||
<privapp-permissions package="com.google.android.euicc">
|
||||
<permission name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<permission name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"/>
|
||||
<permission name="android.permission.FOREGROUND_SERVICE"/>
|
||||
<permission name="android.permission.MODIFY_PHONE_STATE"/>
|
||||
<permission name="android.permission.INTERNET"/>
|
||||
<permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
|
||||
<permission name="android.permission.REBOOT"/>
|
||||
<permission name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
<permission name="android.permission.START_FOREGROUND_SERVICES_FROM_BACKGROUND"/>
|
||||
<permission name="android.permission.VIBRATE"/>
|
||||
<permission name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"/>
|
||||
<permission name="android.permission.WRITE_SECURE_SETTINGS"/>
|
||||
<permission name="com.android.permission.INSTALL_EXISTING_PACKAGES"/>
|
||||
<permission name="com.android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"/>
|
||||
<permission name="com.android.permission.INSTALL_EXISTING_PACKAGES" />
|
||||
<permission name="android.permission.START_ACTIVITIES_FROM_BACKGROUND"/>
|
||||
<permission name="android.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS"/>
|
||||
<permission name="android.permission.READ_NETWORK_USAGE_HISTORY"/>
|
||||
<permission name="com.google.android.setupwizard.SETUP_COMPAT_SERVICE"/>
|
||||
<permission name="com.google.android.permission.USE_GRIL" />
|
||||
</privapp-permissions>
|
||||
</permissions>
|
||||
@@ -1,3 +0,0 @@
|
||||
-keep class co.aospa.euicc.* {
|
||||
*;
|
||||
}
|
||||
Binary file not shown.
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023 The LineageOS Project
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<resources>
|
||||
<string name="sim_illustration_lottie_mappings_json">{\"sim_illustration_lottie_mappings\":[{\"devices\":[\"diting\",\"ziyi\",\"nuwa\",\"fuxi\"],\"illustration_lottie\":\"sim_illustration_lottie_bottom\"}]}</string>
|
||||
<string name="sim_slot_mappings_json">{\"sim-slot-mappings\":[{\"devices\":[\"diting\",\"ziyi\",\"nuwa\",\"fuxi\"],\"esim-slot-ids\":[1],\"psim-slot-ids\":[0]}]}</string>
|
||||
</resources>
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.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 = "XiaomiEuiccBootReceiver"
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2024 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.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 = "XiaomiEuiccDisabler"
|
||||
|
||||
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 co.aospa.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 = "XiaomiEuiccReceiver"
|
||||
}
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.ifaa.aidl.manager
|
||||
|
||||
import android.app.Service
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.IHwBinder
|
||||
import android.os.SystemProperties
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import org.ifaa.aidl.manager.IfaaManagerService
|
||||
import org.json.JSONObject
|
||||
import vendor.xiaomi.hardware.mlipay.V1_1.IMlipayService
|
||||
|
||||
class IfaaService : Service() {
|
||||
private var _mlipayService: IMlipayService? = null
|
||||
|
||||
private val mlipayServiceDeathRecipient = IHwBinder.DeathRecipient {
|
||||
Log.i(LOG_TAG, "mlipay service died")
|
||||
_mlipayService = null
|
||||
}
|
||||
|
||||
private val mBinder = object : IfaaManagerService.Stub() {
|
||||
override fun getSupportBIOTypes(): Int {
|
||||
val fpVendor = SystemProperties.get(FP_VENDOR_PROP, "")
|
||||
val isUdfps = SystemProperties.getBoolean(IS_UDFPS_PROP, false)
|
||||
|
||||
val supportedBioMask = when (!invalidFpVendors.contains(fpVendor.lowercase())) {
|
||||
true -> AUTH_TYPE_FINGERPRINT or AUTH_TYPE_IRIS
|
||||
else -> AUTH_TYPE_IRIS
|
||||
}
|
||||
|
||||
val ifaaProp = SystemProperties.getInt(
|
||||
SUPPORTED_BIO_MASK_PROP, 0
|
||||
) and supportedBioMask or when (isUdfps) {
|
||||
true -> AUTH_TYPE_OPTICAL_FINGERPRINT
|
||||
else -> 0
|
||||
}
|
||||
|
||||
return ifaaProp
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
else -> COMMAND_FAIL
|
||||
}
|
||||
|
||||
override fun getDeviceModel() = "${Build.MANUFACTURER}-${Build.DEVICE}"
|
||||
|
||||
override fun processCmd(param: ByteArray) = getMlipayService()?.let { mlipayService ->
|
||||
var receiveBuffer: ByteArray? = null
|
||||
|
||||
val paramByteArray = ArrayList<Byte>().apply {
|
||||
for (byte in param) {
|
||||
add(byte)
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
val receiveBufferByteArray = mlipayService.invoke_command(
|
||||
paramByteArray, paramByteArray.size
|
||||
)
|
||||
|
||||
receiveBuffer = receiveBufferByteArray.toByteArray()
|
||||
} catch (e: Exception) {
|
||||
Log.e(LOG_TAG, "processCmdImpl: mlipay invoke_command failed", e)
|
||||
}
|
||||
|
||||
receiveBuffer
|
||||
}
|
||||
|
||||
override fun getVersion() = 4
|
||||
|
||||
override fun getExtInfo(authType: Int, keyExtInfo: String) = initExtString()
|
||||
|
||||
override fun setExtInfo(authType: Int, keyExtInfo: String, valExtInfo: String) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
override fun getEnabled(bioType: Int) = when (bioType) {
|
||||
AUTH_TYPE_FINGERPRINT -> BIOMETRICS_AVAILABLE
|
||||
else -> SCREEN_LOCK_NONE
|
||||
}
|
||||
|
||||
override fun getIDList(bioType: Int): IntArray {
|
||||
var idList = IntArray(0)
|
||||
|
||||
getMlipayService()?.let { mlipayService ->
|
||||
try {
|
||||
val idListAL = mlipayService.ifaa_get_idlist(bioType)
|
||||
|
||||
idList = idListAL.toIntArray()
|
||||
} catch (e: Exception) {
|
||||
Log.e(LOG_TAG, "getIDListImpl: mlipay ifaa_get_idlist failed", e)
|
||||
}
|
||||
}
|
||||
|
||||
return idList
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBind(intent: Intent) = mBinder
|
||||
|
||||
private fun getMlipayService() = _mlipayService ?: runCatching {
|
||||
IMlipayService.getService(true)
|
||||
}.onSuccess {
|
||||
_mlipayService = it
|
||||
it.linkToDeath(mlipayServiceDeathRecipient, 0)
|
||||
}.getOrNull()
|
||||
|
||||
private fun initExtString(): String {
|
||||
val obj = JSONObject()
|
||||
val keyInfo = JSONObject()
|
||||
|
||||
val xy = SystemProperties.get(UDFPS_LOCATION_X_Y_PROP, "")
|
||||
val wh = SystemProperties.get(UDFPS_SIZE_W_H_PROP, "")
|
||||
|
||||
try {
|
||||
if (!validateVal(xy) || !validateVal(wh)) {
|
||||
Log.e(LOG_TAG, "initExtString: invalidate, xy: $xy, wh: $wh")
|
||||
return ""
|
||||
}
|
||||
|
||||
val split = xy.split(",")
|
||||
val split2 = wh.split(",")
|
||||
|
||||
keyInfo.put("startX", split[0].toInt())
|
||||
keyInfo.put("startY", split[1].toInt())
|
||||
keyInfo.put("width", split2[0].toInt())
|
||||
keyInfo.put("height", split2[1].toInt())
|
||||
keyInfo.put("navConflict", true)
|
||||
|
||||
obj.put("type", 0)
|
||||
obj.put("fullView", keyInfo)
|
||||
|
||||
return obj.toString()
|
||||
} catch (e: Exception) {
|
||||
Log.e(LOG_TAG, "initExtString: Exception, xy: $xy, wh: $wh", e)
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
private fun validateVal(str: String) = !"".equals(str, ignoreCase = true) && str.contains(",")
|
||||
|
||||
companion object {
|
||||
private val LOG_TAG = IfaaService::class.simpleName!!
|
||||
|
||||
private const val AUTH_TYPE_NOT_SUPPORT = 0
|
||||
private const val AUTH_TYPE_FINGERPRINT = 1
|
||||
private const val AUTH_TYPE_IRIS = 1.shl(1)
|
||||
private const val AUTH_TYPE_OPTICAL_FINGERPRINT = 1.shl(2)
|
||||
|
||||
private const val BIOMETRICS_AVAILABLE = 1000
|
||||
private const val SCREEN_LOCK_NONE = 1003
|
||||
|
||||
private const val COMMAND_OK = 0
|
||||
private const val COMMAND_FAIL = -1
|
||||
|
||||
private const val SUPPORTED_BIO_MASK_PROP = "persist.vendor.sys.pay.ifaa"
|
||||
private const val FP_VENDOR_PROP = "persist.vendor.sys.fp.vendor"
|
||||
private const val IS_UDFPS_PROP = "ro.hardware.fp.udfps"
|
||||
private const val UDFPS_LOCATION_X_Y_PROP = "persist.vendor.sys.fp.udfps.location.X_Y"
|
||||
private const val UDFPS_SIZE_W_H_PROP = "persist.vendor.sys.fp.udfps.size.width_height"
|
||||
|
||||
private val invalidFpVendors = arrayOf(
|
||||
"",
|
||||
"none",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -7,3 +7,4 @@ service vendor.fingerprint-default /vendor/bin/hw/android.hardware.biometrics.fi
|
||||
group system input uhid
|
||||
capabilities SYS_NICE
|
||||
shutdown critical
|
||||
task_profiles ProcessCapacityHigh MaxPerformance
|
||||
|
||||
@@ -19,6 +19,12 @@ package {
|
||||
default_applicable_licenses: ["Android-Apache-2.0"],
|
||||
}
|
||||
|
||||
vintf_fragment {
|
||||
name: "android.hardware.sensors.xiaomi-multihal.xml",
|
||||
src: "android.hardware.sensors.xiaomi-multihal.xml",
|
||||
vendor: true,
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
name: "android.hardware.sensors-service.xiaomi-multihal",
|
||||
vendor: true,
|
||||
@@ -33,7 +39,7 @@ cc_binary {
|
||||
"android.hardware.sensors@2.X-shared-utils",
|
||||
],
|
||||
init_rc: ["android.hardware.sensors-service.xiaomi-multihal.rc"],
|
||||
vintf_fragments: ["android.hardware.sensors.xiaomi-multihal.xml"],
|
||||
vintf_fragment_modules: ["android.hardware.sensors.xiaomi-multihal.xml"],
|
||||
shared_libs: [
|
||||
"android.hardware.sensors@2.0-ScopedWakelock",
|
||||
"android.hardware.sensors@2.0",
|
||||
|
||||
@@ -147,9 +147,9 @@ Return<void> HalProxy::getSensorsList_2_1(ISensorsV2_1::getSensorsList_2_1_cb _h
|
||||
Return<void> HalProxy::getSensorsList(ISensorsV2_0::getSensorsList_cb _hidl_cb) {
|
||||
std::vector<V1_0::SensorInfo> sensors;
|
||||
for (const auto& iter : mSensors) {
|
||||
if (iter.second.type != SensorType::HINGE_ANGLE) {
|
||||
sensors.push_back(convertToOldSensorInfo(iter.second));
|
||||
}
|
||||
if (iter.second.type != SensorType::HINGE_ANGLE) {
|
||||
sensors.push_back(convertToOldSensorInfo(iter.second));
|
||||
}
|
||||
}
|
||||
_hidl_cb(sensors);
|
||||
return Void();
|
||||
@@ -612,7 +612,8 @@ void HalProxy::handlePendingWrites() {
|
||||
static_cast<uint32_t>(EventQueueFlagBits::EVENTS_READ),
|
||||
static_cast<uint32_t>(EventQueueFlagBits::READ_AND_PROCESS),
|
||||
kPendingWriteTimeoutNs, mEventQueueFlag)) {
|
||||
ALOGE("Dropping %zu events after blockingWrite failed.", numToWrite);
|
||||
ALOGE("Dropping %zu events after blockingWrite failed (is system_server running?).",
|
||||
numToWrite);
|
||||
if (numWakeupEvents > 0) {
|
||||
if (pendingWriteEvents.size() > eventQueueSize) {
|
||||
decrementRefCountAndMaybeReleaseWakelock(
|
||||
@@ -735,8 +736,7 @@ void HalProxy::decrementRefCountAndMaybeReleaseWakelock(size_t delta,
|
||||
if (!mThreadsRun.load()) return;
|
||||
std::lock_guard<std::recursive_mutex> lockGuard(mWakelockMutex);
|
||||
if (delta > mWakelockRefCount) {
|
||||
ALOGE("Decrementing wakelock ref count by %zu when count is %zu",
|
||||
delta, mWakelockRefCount);
|
||||
ALOGE("Decrementing wakelock ref count by %zu when count is %zu", delta, mWakelockRefCount);
|
||||
}
|
||||
if (timeoutStart == -1) timeoutStart = mWakelockTimeoutResetTime;
|
||||
if (mWakelockRefCount == 0 || timeoutStart < mWakelockTimeoutResetTime) return;
|
||||
|
||||
@@ -74,8 +74,7 @@ std::vector<V2_1::Event> HalProxyCallbackBase::processEvents(const std::vector<V
|
||||
}
|
||||
const V2_1::SensorInfo& sensor = mCallback->getSensorInfo(event.sensorHandle);
|
||||
|
||||
if (sensor.type == V2_1::SensorType::PICK_UP_GESTURE
|
||||
&& event.u.scalar != 1) {
|
||||
if (sensor.type == V2_1::SensorType::PICK_UP_GESTURE && event.u.scalar != 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
on boot
|
||||
setprop vendor.sensors.dynamic_sensor_op_timeout_ms 1600
|
||||
|
||||
service vendor.sensors-hal-multihal /vendor/bin/hw/android.hardware.sensors-service.xiaomi-multihal
|
||||
class hal
|
||||
user system
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<activity
|
||||
android:name=".DolbyActivity"
|
||||
android:label="@string/dolby_title"
|
||||
android:theme="@style/Theme.SubSettingsBase"
|
||||
android:theme="@style/Theme.SubSettingsBase.Expressive"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="com.android.settings.action.IA_SETTINGS" />
|
||||
@@ -50,7 +50,7 @@
|
||||
<activity
|
||||
android:name=".geq.EqualizerActivity"
|
||||
android:label="@string/dolby_preset"
|
||||
android:theme="@style/Theme.SubSettingsBase"
|
||||
android:theme="@style/Theme.SubSettingsBase.Expressive"
|
||||
android:exported="true" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@@ -10,14 +10,16 @@ import android.os.Bundle
|
||||
import co.aospa.dolby.xiaomi.preference.DolbySettingsFragment
|
||||
import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity
|
||||
|
||||
private const val TAG = "DolbyActivity"
|
||||
|
||||
class DolbyActivity : CollapsingToolbarBaseActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(com.android.settingslib.collapsingtoolbar.R.id.content_frame, DolbySettingsFragment(), TAG)
|
||||
.commit()
|
||||
supportFragmentManager
|
||||
.beginTransaction()
|
||||
.replace(
|
||||
com.android.settingslib.collapsingtoolbar.R.id.content_frame,
|
||||
DolbySettingsFragment(),
|
||||
)
|
||||
.commit()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,21 +6,20 @@
|
||||
|
||||
package co.aospa.dolby.xiaomi.preference
|
||||
|
||||
import android.content.Context
|
||||
import android.media.AudioAttributes
|
||||
import android.media.AudioDeviceCallback
|
||||
import android.media.AudioDeviceInfo
|
||||
import android.media.AudioManager
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.View
|
||||
import android.widget.CompoundButton
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener
|
||||
import android.widget.Toast
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.Preference.OnPreferenceChangeListener
|
||||
import androidx.preference.PreferenceFragment
|
||||
import androidx.preference.SwitchPreferenceCompat
|
||||
import co.aospa.dolby.xiaomi.DolbyConstants
|
||||
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.PREF_BASS
|
||||
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.PREF_DIALOGUE
|
||||
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.PREF_ENABLE
|
||||
@@ -36,47 +35,33 @@ import co.aospa.dolby.xiaomi.DolbyConstants.Companion.dlog
|
||||
import co.aospa.dolby.xiaomi.DolbyController
|
||||
import co.aospa.dolby.xiaomi.R
|
||||
import com.android.settingslib.widget.MainSwitchPreference
|
||||
import com.android.settingslib.widget.SettingsBasePreferenceFragment
|
||||
|
||||
class DolbySettingsFragment : PreferenceFragment(),
|
||||
OnPreferenceChangeListener, OnCheckedChangeListener {
|
||||
class DolbySettingsFragment : SettingsBasePreferenceFragment(),
|
||||
Preference.OnPreferenceChangeListener, CompoundButton.OnCheckedChangeListener {
|
||||
|
||||
private val switchBar by lazy {
|
||||
findPreference<MainSwitchPreference>(PREF_ENABLE)!!
|
||||
}
|
||||
private val profilePref by lazy {
|
||||
findPreference<ListPreference>(PREF_PROFILE)!!
|
||||
}
|
||||
private val presetPref by lazy {
|
||||
findPreference<Preference>(PREF_PRESET)!!
|
||||
}
|
||||
private val ieqPref by lazy {
|
||||
findPreference<DolbyIeqPreference>(PREF_IEQ)!!
|
||||
}
|
||||
private val stereoPref by lazy {
|
||||
findPreference<ListPreference>(PREF_STEREO)!!
|
||||
}
|
||||
private val dialoguePref by lazy {
|
||||
findPreference<ListPreference>(PREF_DIALOGUE)!!
|
||||
}
|
||||
private val bassPref by lazy {
|
||||
findPreference<SwitchPreferenceCompat>(PREF_BASS)!!
|
||||
}
|
||||
private val hpVirtPref by lazy {
|
||||
findPreference<SwitchPreferenceCompat>(PREF_HP_VIRTUALIZER)!!
|
||||
}
|
||||
private val spkVirtPref by lazy {
|
||||
findPreference<SwitchPreferenceCompat>(PREF_SPK_VIRTUALIZER)!!
|
||||
}
|
||||
private val volumePref by lazy {
|
||||
findPreference<SwitchPreferenceCompat>(PREF_VOLUME)!!
|
||||
}
|
||||
private val resetPref by lazy {
|
||||
findPreference<Preference>(PREF_RESET)!!
|
||||
}
|
||||
private val appContext: Context
|
||||
get() = requireContext().applicationContext
|
||||
|
||||
private val dolbyController by lazy { DolbyController.getInstance(context) }
|
||||
private val audioManager by lazy { context.getSystemService(AudioManager::class.java)!! }
|
||||
private val handler = Handler()
|
||||
private val switchBar by lazy { findPreference<MainSwitchPreference>(PREF_ENABLE)!! }
|
||||
private val profilePref by lazy { findPreference<ListPreference>(PREF_PROFILE)!! }
|
||||
private val presetPref by lazy { findPreference<Preference>(PREF_PRESET)!! }
|
||||
private val ieqPref by lazy { findPreference<DolbyIeqPreference>(PREF_IEQ)!! }
|
||||
private val stereoPref by lazy { findPreference<ListPreference>(PREF_STEREO)!! }
|
||||
private val dialoguePref by lazy { findPreference<ListPreference>(PREF_DIALOGUE)!! }
|
||||
private val bassPref by lazy { findPreference<SwitchPreferenceCompat>(PREF_BASS)!! }
|
||||
private val hpVirtPref by lazy { findPreference<SwitchPreferenceCompat>(PREF_HP_VIRTUALIZER)!! }
|
||||
private val spkVirtPref by lazy { findPreference<SwitchPreferenceCompat>(PREF_SPK_VIRTUALIZER)!! }
|
||||
private val volumePref by lazy { findPreference<SwitchPreferenceCompat>(PREF_VOLUME)!! }
|
||||
private val resetPref by lazy { findPreference<Preference>(PREF_RESET)!! }
|
||||
|
||||
private val dolbyController by lazy(LazyThreadSafetyMode.NONE) {
|
||||
DolbyController.getInstance(appContext)
|
||||
}
|
||||
private val audioManager by lazy(LazyThreadSafetyMode.NONE) {
|
||||
appContext.getSystemService(AudioManager::class.java)
|
||||
}
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
|
||||
private var isOnSpeaker = true
|
||||
set(value) {
|
||||
@@ -100,26 +85,29 @@ class DolbySettingsFragment : PreferenceFragment(),
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
dlog(TAG, "onCreatePreferences")
|
||||
addPreferencesFromResource(R.xml.dolby_settings)
|
||||
setPreferencesFromResource(R.xml.dolby_settings, rootKey)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
val profile = dolbyController.profile
|
||||
preferenceManager.preferenceDataStore = DolbyPreferenceStore(context).also {
|
||||
preferenceManager.preferenceDataStore = DolbyPreferenceStore(appContext).also {
|
||||
it.profile = profile
|
||||
}
|
||||
|
||||
val dsOn = dolbyController.dsOn
|
||||
switchBar.addOnSwitchChangeListener(this)
|
||||
switchBar.setChecked(dsOn)
|
||||
switchBar.isChecked = dsOn
|
||||
|
||||
profilePref.onPreferenceChangeListener = this
|
||||
updateProfileIcon(profile)
|
||||
profilePref.setEnabled(dsOn)
|
||||
profilePref.isEnabled = dsOn
|
||||
profilePref.apply {
|
||||
if (entryValues.contains(profile.toString())) {
|
||||
summary = "%s"
|
||||
value = profile.toString()
|
||||
} else {
|
||||
summary = context.getString(R.string.dolby_unknown)
|
||||
summary = getString(R.string.dolby_unknown)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,21 +123,21 @@ class DolbySettingsFragment : PreferenceFragment(),
|
||||
dolbyController.resetProfileSpecificSettings()
|
||||
updateProfileSpecificPrefs()
|
||||
Toast.makeText(
|
||||
context,
|
||||
context.getString(R.string.dolby_reset_profile_toast, profilePref.summary),
|
||||
appContext,
|
||||
getString(R.string.dolby_reset_profile_toast, profilePref.summary),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
true
|
||||
}
|
||||
|
||||
audioManager.registerAudioDeviceCallback(audioDeviceCallback, handler)
|
||||
audioManager?.registerAudioDeviceCallback(audioDeviceCallback, handler)
|
||||
updateSpeakerState()
|
||||
updateProfileSpecificPrefs()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
dlog(TAG, "onDestroyView")
|
||||
audioManager.unregisterAudioDeviceCallback(audioDeviceCallback)
|
||||
audioManager?.unregisterAudioDeviceCallback(audioDeviceCallback)
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
@@ -168,35 +156,13 @@ class DolbySettingsFragment : PreferenceFragment(),
|
||||
updateProfileIcon(profile)
|
||||
updateProfileSpecificPrefs()
|
||||
}
|
||||
|
||||
PREF_SPK_VIRTUALIZER -> {
|
||||
dolbyController.setSpeakerVirtEnabled(newValue as Boolean)
|
||||
}
|
||||
|
||||
PREF_HP_VIRTUALIZER -> {
|
||||
dolbyController.setHeadphoneVirtEnabled(newValue as Boolean)
|
||||
}
|
||||
|
||||
PREF_STEREO -> {
|
||||
dolbyController.setStereoWideningAmount(newValue.toString().toInt())
|
||||
}
|
||||
|
||||
PREF_DIALOGUE -> {
|
||||
dolbyController.setDialogueEnhancerAmount(newValue.toString().toInt())
|
||||
}
|
||||
|
||||
PREF_BASS -> {
|
||||
dolbyController.setBassEnhancerEnabled(newValue as Boolean)
|
||||
}
|
||||
|
||||
PREF_VOLUME -> {
|
||||
dolbyController.setVolumeLevelerEnabled(newValue as Boolean)
|
||||
}
|
||||
|
||||
PREF_IEQ -> {
|
||||
dolbyController.setIeqPreset(newValue.toString().toInt())
|
||||
}
|
||||
|
||||
PREF_SPK_VIRTUALIZER -> dolbyController.setSpeakerVirtEnabled(newValue as Boolean)
|
||||
PREF_HP_VIRTUALIZER -> dolbyController.setHeadphoneVirtEnabled(newValue as Boolean)
|
||||
PREF_STEREO -> dolbyController.setStereoWideningAmount(newValue.toString().toInt())
|
||||
PREF_DIALOGUE -> dolbyController.setDialogueEnhancerAmount(newValue.toString().toInt())
|
||||
PREF_BASS -> dolbyController.setBassEnhancerEnabled(newValue as Boolean)
|
||||
PREF_VOLUME -> dolbyController.setVolumeLevelerEnabled(newValue as Boolean)
|
||||
PREF_IEQ -> dolbyController.setIeqPreset(newValue.toString().toInt())
|
||||
else -> return false
|
||||
}
|
||||
return true
|
||||
@@ -205,18 +171,21 @@ class DolbySettingsFragment : PreferenceFragment(),
|
||||
override fun onCheckedChanged(buttonView: CompoundButton, isChecked: Boolean) {
|
||||
dlog(TAG, "onCheckedChanged($isChecked)")
|
||||
dolbyController.dsOn = isChecked
|
||||
profilePref.setEnabled(isChecked)
|
||||
profilePref.isEnabled = isChecked
|
||||
updateProfileSpecificPrefs()
|
||||
}
|
||||
|
||||
private fun updateSpeakerState() {
|
||||
val device = audioManager.getDevicesForAttributes(ATTRIBUTES_MEDIA)[0]
|
||||
isOnSpeaker = (device.type == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER)
|
||||
val devices = audioManager
|
||||
?.getDevicesForAttributes(ATTRIBUTES_MEDIA)
|
||||
.orEmpty()
|
||||
val firstType = devices.firstOrNull()?.type
|
||||
isOnSpeaker = (firstType == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER)
|
||||
}
|
||||
|
||||
private fun updateProfileSpecificPrefs() {
|
||||
val unknownRes = context.getString(R.string.dolby_unknown)
|
||||
val headphoneRes = context.getString(R.string.dolby_connect_headphones)
|
||||
val unknownRes = getString(R.string.dolby_unknown)
|
||||
val headphoneRes = getString(R.string.dolby_connect_headphones)
|
||||
val dsOn = dolbyController.dsOn
|
||||
val currentProfile = dolbyController.profile
|
||||
|
||||
@@ -226,15 +195,15 @@ class DolbySettingsFragment : PreferenceFragment(),
|
||||
)
|
||||
|
||||
val enable = dsOn && (currentProfile != -1)
|
||||
presetPref.setEnabled(enable)
|
||||
spkVirtPref.setEnabled(enable)
|
||||
ieqPref.setEnabled(enable)
|
||||
dialoguePref.setEnabled(enable)
|
||||
volumePref.setEnabled(enable)
|
||||
bassPref.setEnabled(enable)
|
||||
resetPref.setEnabled(enable)
|
||||
hpVirtPref.setEnabled(enable && !isOnSpeaker)
|
||||
stereoPref.setEnabled(enable && !isOnSpeaker)
|
||||
presetPref.isEnabled = enable
|
||||
spkVirtPref.isEnabled = enable
|
||||
ieqPref.isEnabled = enable
|
||||
dialoguePref.isEnabled = enable
|
||||
volumePref.isEnabled = enable
|
||||
bassPref.isEnabled = enable
|
||||
resetPref.isEnabled = enable
|
||||
hpVirtPref.isEnabled = enable && !isOnSpeaker
|
||||
stereoPref.isEnabled = enable && !isOnSpeaker
|
||||
|
||||
if (!enable) return
|
||||
|
||||
@@ -260,9 +229,9 @@ class DolbySettingsFragment : PreferenceFragment(),
|
||||
}
|
||||
}
|
||||
|
||||
spkVirtPref.setChecked(dolbyController.getSpeakerVirtEnabled(currentProfile))
|
||||
volumePref.setChecked(dolbyController.getVolumeLevelerEnabled(currentProfile))
|
||||
bassPref.setChecked(dolbyController.getBassEnhancerEnabled(currentProfile))
|
||||
spkVirtPref.isChecked = dolbyController.getSpeakerVirtEnabled(currentProfile)
|
||||
volumePref.isChecked = dolbyController.getVolumeLevelerEnabled(currentProfile)
|
||||
bassPref.isChecked = dolbyController.getBassEnhancerEnabled(currentProfile)
|
||||
|
||||
// below prefs are not enabled on loudspeaker
|
||||
if (isOnSpeaker) {
|
||||
@@ -282,7 +251,7 @@ class DolbySettingsFragment : PreferenceFragment(),
|
||||
}
|
||||
|
||||
hpVirtPref.apply {
|
||||
setChecked(dolbyController.getHeadphoneVirtEnabled(currentProfile))
|
||||
isChecked = dolbyController.getHeadphoneVirtEnabled(currentProfile)
|
||||
summary = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,42 +2,19 @@
|
||||
* Copyright (C) 2022 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
*/
|
||||
|
||||
static int stub_fail() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
static char *stub_fail_str() {
|
||||
static char* stub_fail_str() {
|
||||
return "stub";
|
||||
}
|
||||
|
||||
void *mg_facepp[] = {
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail_str,
|
||||
&stub_fail_str,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
&stub_fail,
|
||||
void* mg_facepp[] = {
|
||||
&stub_fail, &stub_fail, &stub_fail, &stub_fail_str, &stub_fail_str, &stub_fail, &stub_fail,
|
||||
&stub_fail, &stub_fail, &stub_fail, &stub_fail, &stub_fail, &stub_fail, &stub_fail,
|
||||
&stub_fail, &stub_fail, &stub_fail, &stub_fail, &stub_fail, &stub_fail, &stub_fail,
|
||||
&stub_fail, &stub_fail, &stub_fail, &stub_fail, &stub_fail, &stub_fail,
|
||||
};
|
||||
|
||||
18
packages/Euicc/Android.bp
Normal file
18
packages/Euicc/Android.bp
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
//
|
||||
// SPDX-FileCopyrightText: The LineageOS Project
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
phony {
|
||||
name: "XiaomiEuicc",
|
||||
required: [
|
||||
"EuiccPolicy",
|
||||
"EuiccPolicyXiaomi",
|
||||
],
|
||||
}
|
||||
|
||||
runtime_resource_overlay {
|
||||
name: "EuiccPolicyXiaomi",
|
||||
product_specific: true,
|
||||
}
|
||||
10
packages/Euicc/AndroidManifest.xml
Normal file
10
packages/Euicc/AndroidManifest.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
SPDX-FileCopyrightText: The LineageOS Project
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.lineageos.euicc.overlay.xiaomi">
|
||||
<overlay android:targetPackage="org.lineageos.euicc"
|
||||
android:isStatic="true" />
|
||||
</manifest>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
42
packages/Euicc/res/values/strings.xml
Normal file
42
packages/Euicc/res/values/strings.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
SPDX-FileCopyrightText: The LineageOS Project
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<resources>
|
||||
<string name="sim_slot_mappings_json" translatable="false">
|
||||
{
|
||||
\"sim-slot-mappings\": [
|
||||
{
|
||||
\"devices\": [
|
||||
\"XIG05\",
|
||||
\"fuxi\",
|
||||
\"garnet\",
|
||||
\"nuwa\"
|
||||
],
|
||||
\"esim-slot-ids\": [
|
||||
1
|
||||
],
|
||||
\"psim-slot-ids\": [
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
</string>
|
||||
<string name="sim_illustration_lottie_mappings_json" translatable="false">
|
||||
{
|
||||
\"sim_illustration_lottie_mappings\": [
|
||||
{
|
||||
\"devices\": [
|
||||
\"XIG05\",
|
||||
\"fuxi\",
|
||||
\"garnet\",
|
||||
\"nuwa\"
|
||||
],
|
||||
\"illustration_lottie\": \"sim_illustration_lottie_bottom\"
|
||||
}
|
||||
]
|
||||
}
|
||||
</string>
|
||||
</resources>
|
||||
188
packages/IFAAService/src/org/ifaa/aidl/manager/IfaaService.kt
Normal file
188
packages/IFAAService/src/org/ifaa/aidl/manager/IfaaService.kt
Normal file
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.ifaa.aidl.manager
|
||||
|
||||
import android.app.Service
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.IHwBinder
|
||||
import android.os.SystemProperties
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import org.json.JSONObject
|
||||
import vendor.xiaomi.hardware.mlipay.V1_1.IMlipayService
|
||||
|
||||
class IfaaService : Service() {
|
||||
private var _mlipayService: IMlipayService? = null
|
||||
|
||||
private val mlipayServiceDeathRecipient =
|
||||
IHwBinder.DeathRecipient {
|
||||
Log.i(LOG_TAG, "mlipay service died")
|
||||
_mlipayService = null
|
||||
}
|
||||
|
||||
private val mBinder =
|
||||
object : IfaaManagerService.Stub() {
|
||||
override fun getSupportBIOTypes(): Int {
|
||||
val fpVendor = SystemProperties.get(FP_VENDOR_PROP, "")
|
||||
val isUdfps = SystemProperties.getBoolean(IS_UDFPS_PROP, false)
|
||||
|
||||
val supportedBioMask =
|
||||
when (!invalidFpVendors.contains(fpVendor.lowercase())) {
|
||||
true -> AUTH_TYPE_FINGERPRINT or AUTH_TYPE_IRIS
|
||||
else -> AUTH_TYPE_IRIS
|
||||
}
|
||||
|
||||
val ifaaProp =
|
||||
SystemProperties.getInt(SUPPORTED_BIO_MASK_PROP, 0) and
|
||||
supportedBioMask or
|
||||
when (isUdfps) {
|
||||
true -> AUTH_TYPE_OPTICAL_FINGERPRINT
|
||||
else -> 0
|
||||
}
|
||||
|
||||
return ifaaProp
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
else -> COMMAND_FAIL
|
||||
}
|
||||
|
||||
override fun getDeviceModel() = "${Build.MANUFACTURER}-${Build.DEVICE}"
|
||||
|
||||
override fun processCmd(param: ByteArray) =
|
||||
getMlipayService()?.let { mlipayService ->
|
||||
var receiveBuffer: ByteArray? = null
|
||||
|
||||
val paramByteArray =
|
||||
ArrayList<Byte>().apply {
|
||||
for (byte in param) {
|
||||
add(byte)
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
val receiveBufferByteArray =
|
||||
mlipayService.invoke_command(paramByteArray, paramByteArray.size)
|
||||
|
||||
receiveBuffer = receiveBufferByteArray.toByteArray()
|
||||
} catch (e: Exception) {
|
||||
Log.e(LOG_TAG, "processCmdImpl: mlipay invoke_command failed", e)
|
||||
}
|
||||
|
||||
receiveBuffer
|
||||
}
|
||||
|
||||
override fun getVersion() = 4
|
||||
|
||||
override fun getExtInfo(authType: Int, keyExtInfo: String) = initExtString()
|
||||
|
||||
override fun setExtInfo(authType: Int, keyExtInfo: String, valExtInfo: String) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
override fun getEnabled(bioType: Int) =
|
||||
when (bioType) {
|
||||
AUTH_TYPE_FINGERPRINT -> BIOMETRICS_AVAILABLE
|
||||
else -> SCREEN_LOCK_NONE
|
||||
}
|
||||
|
||||
override fun getIDList(bioType: Int): IntArray {
|
||||
var idList = IntArray(0)
|
||||
|
||||
getMlipayService()?.let { mlipayService ->
|
||||
try {
|
||||
val idListAL = mlipayService.ifaa_get_idlist(bioType)
|
||||
|
||||
idList = idListAL.toIntArray()
|
||||
} catch (e: Exception) {
|
||||
Log.e(LOG_TAG, "getIDListImpl: mlipay ifaa_get_idlist failed", e)
|
||||
}
|
||||
}
|
||||
|
||||
return idList
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBind(intent: Intent) = mBinder
|
||||
|
||||
private fun getMlipayService() =
|
||||
_mlipayService
|
||||
?: runCatching { IMlipayService.getService(true) }
|
||||
.onSuccess {
|
||||
_mlipayService = it
|
||||
it.linkToDeath(mlipayServiceDeathRecipient, 0)
|
||||
}
|
||||
.getOrNull()
|
||||
|
||||
private fun initExtString(): String {
|
||||
val obj = JSONObject()
|
||||
val keyInfo = JSONObject()
|
||||
|
||||
val xy = SystemProperties.get(UDFPS_LOCATION_X_Y_PROP, "")
|
||||
val wh = SystemProperties.get(UDFPS_SIZE_W_H_PROP, "")
|
||||
|
||||
try {
|
||||
if (!validateVal(xy) || !validateVal(wh)) {
|
||||
Log.e(LOG_TAG, "initExtString: invalidate, xy: $xy, wh: $wh")
|
||||
return ""
|
||||
}
|
||||
|
||||
val split = xy.split(",")
|
||||
val split2 = wh.split(",")
|
||||
|
||||
keyInfo.put("startX", split[0].toInt())
|
||||
keyInfo.put("startY", split[1].toInt())
|
||||
keyInfo.put("width", split2[0].toInt())
|
||||
keyInfo.put("height", split2[1].toInt())
|
||||
keyInfo.put("navConflict", true)
|
||||
|
||||
obj.put("type", 0)
|
||||
obj.put("fullView", keyInfo)
|
||||
|
||||
return obj.toString()
|
||||
} catch (e: Exception) {
|
||||
Log.e(LOG_TAG, "initExtString: Exception, xy: $xy, wh: $wh", e)
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
private fun validateVal(str: String) = !"".equals(str, ignoreCase = true) && str.contains(",")
|
||||
|
||||
companion object {
|
||||
private val LOG_TAG = IfaaService::class.simpleName!!
|
||||
|
||||
private const val AUTH_TYPE_NOT_SUPPORT = 0
|
||||
private const val AUTH_TYPE_FINGERPRINT = 1
|
||||
private const val AUTH_TYPE_IRIS = 1.shl(1)
|
||||
private const val AUTH_TYPE_OPTICAL_FINGERPRINT = 1.shl(2)
|
||||
|
||||
private const val BIOMETRICS_AVAILABLE = 1000
|
||||
private const val SCREEN_LOCK_NONE = 1003
|
||||
|
||||
private const val COMMAND_OK = 0
|
||||
private const val COMMAND_FAIL = -1
|
||||
|
||||
private const val SUPPORTED_BIO_MASK_PROP = "persist.vendor.sys.pay.ifaa"
|
||||
private const val FP_VENDOR_PROP = "persist.vendor.sys.fp.vendor"
|
||||
private const val IS_UDFPS_PROP = "ro.hardware.fp.udfps"
|
||||
private const val UDFPS_LOCATION_X_Y_PROP = "persist.vendor.sys.fp.udfps.location.X_Y"
|
||||
private const val UDFPS_SIZE_W_H_PROP = "persist.vendor.sys.fp.udfps.size.width_height"
|
||||
|
||||
private val invalidFpVendors = arrayOf("", "none")
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <string.h>
|
||||
#include <utils/SystemClock.h>
|
||||
|
||||
static const char *udfps_state_paths[] = {
|
||||
static const char* udfps_state_paths[] = {
|
||||
"/sys/devices/virtual/touch/tp_dev/fp_state",
|
||||
"/sys/touchpanel/fp_state",
|
||||
NULL,
|
||||
|
||||
@@ -221,7 +221,7 @@ SysfsPollingOneShotSensor::SysfsPollingOneShotSensor(
|
||||
int32_t sensorHandle, ISensorsEventCallback* callback, const std::string& pollPath,
|
||||
const std::string& enablePath, const std::string& name, const std::string& typeAsString,
|
||||
SensorType type)
|
||||
: OneShotSensor(sensorHandle, callback) {
|
||||
: OneShotSensor(sensorHandle, callback), mEnablePath(enablePath) {
|
||||
mSensorInfo.name = name;
|
||||
mSensorInfo.type = type;
|
||||
mSensorInfo.typeAsString = typeAsString;
|
||||
@@ -230,8 +230,6 @@ SysfsPollingOneShotSensor::SysfsPollingOneShotSensor(
|
||||
mSensorInfo.power = 0;
|
||||
mSensorInfo.flags |= SensorFlagBits::WAKE_UP;
|
||||
|
||||
mEnableStream.open(enablePath);
|
||||
|
||||
int rc;
|
||||
|
||||
rc = pipe(mWaitPipeFd);
|
||||
@@ -267,8 +265,12 @@ SysfsPollingOneShotSensor::~SysfsPollingOneShotSensor() {
|
||||
}
|
||||
|
||||
void SysfsPollingOneShotSensor::writeEnable(bool enable) {
|
||||
std::call_once(mEnableOpenOnce, [&] { mEnableStream.open(mEnablePath); });
|
||||
|
||||
if (mEnableStream) {
|
||||
mEnableStream << (enable ? '1' : '0') << std::flush;
|
||||
} else {
|
||||
ALOGE("Failed to write enable to %s", mEnablePath.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace implementation {
|
||||
|
||||
class ISensorsEventCallback {
|
||||
public:
|
||||
virtual ~ISensorsEventCallback(){};
|
||||
virtual ~ISensorsEventCallback() {};
|
||||
virtual void postEvents(const std::vector<Event>& events, bool wakeup) = 0;
|
||||
};
|
||||
|
||||
@@ -119,6 +119,8 @@ class SysfsPollingOneShotSensor : public OneShotSensor {
|
||||
struct pollfd mPolls[2];
|
||||
int mWaitPipeFd[2];
|
||||
int mPollFd;
|
||||
std::string mEnablePath;
|
||||
std::once_flag mEnableOpenOnce;
|
||||
};
|
||||
|
||||
class DoubleTapSensor : public SysfsPollingOneShotSensor {
|
||||
|
||||
Reference in New Issue
Block a user