Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
877c1a0564 | ||
|
|
201fd3cc32 | ||
|
|
56626e0201 | ||
|
|
edb30cd0c5 | ||
|
|
a65af94562 | ||
|
|
dd3baf47d3 | ||
|
|
4d5a25b7c1 | ||
|
|
bf39dfb28b |
@@ -1,13 +0,0 @@
|
||||
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
|
||||
1
.clang-format
Symbolic link
1
.clang-format
Symbolic link
@@ -0,0 +1 @@
|
||||
../../build/soong/scripts/system-clang-format
|
||||
13
.github/workflows/build/action.yml
vendored
13
.github/workflows/build/action.yml
vendored
@@ -1,13 +0,0 @@
|
||||
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
38
.github/workflows/gerrit.yml
vendored
@@ -1,38 +0,0 @@
|
||||
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 }}
|
||||
@@ -1,20 +0,0 @@
|
||||
# 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]
|
||||
@@ -8,7 +8,7 @@ android_app {
|
||||
name: "AdvancedDisplay",
|
||||
|
||||
srcs: ["src/**/*.java"],
|
||||
|
||||
resource_dirs: ["res"],
|
||||
certificate: "platform",
|
||||
platform_apis: true,
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@
|
||||
<meta-data
|
||||
android:name="com.android.settings.category"
|
||||
android:value="com.android.settings.category.ia.display" />
|
||||
<meta-data
|
||||
android:name="com.android.settings.group_key"
|
||||
android:value="category_key_color" />
|
||||
<meta-data
|
||||
android:name="com.android.settings.summary"
|
||||
android:value="@string/summary_empty" />
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
-keepclasseswithmembers class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet);
|
||||
}
|
||||
|
||||
-keep class ** extends android.support.v14.preference.PreferenceFragment
|
||||
|
||||
1
AdvancedDisplay/res/layout/framelayout.xml
Normal file → Executable file
1
AdvancedDisplay/res/layout/framelayout.xml
Normal file → Executable file
@@ -2,3 +2,4 @@
|
||||
android:id="@+id/frameLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
<string name="screen_colors_title">Rənglər</string>
|
||||
<string name="mdnie_scenario_title_head">Ekran rejimi</string>
|
||||
<string name="mdnie_scenario_summary_head">mDNle ssenarisini ayarla</string>
|
||||
<string name="mdnie_accessibility_title_head">Erişiləbilənlik rejimi</string>
|
||||
<string name="mdnie_accessibility_summary_head">mDNIe erişiləbilənlik rejimini ayarla</string>
|
||||
<string name="mdnie_accessibility_title_head">Əlçatımlılıq rejimi</string>
|
||||
<string name="mdnie_accessibility_summary_head">mDNIe əlçatımlılıq rejimini ayarla</string>
|
||||
<string name="mdnie_scenario_ui">LineageOS (ilkin)</string>
|
||||
<string name="mdnie_scenario_video">Video</string>
|
||||
<string name="mdnie_scenario_video_warm">Video - isti</string>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<string name="app_name">Налады экрана</string>
|
||||
<string name="category_screen_title">Экран</string>
|
||||
<string name="screen_colors_title">Колеры</string>
|
||||
<string name="mdnie_scenario_video_warm">Відэа (цёплыя тоны)</string>
|
||||
@@ -25,7 +26,6 @@
|
||||
<string name="mdnie_scenario_vt">Відэавыклік</string>
|
||||
<string name="mdnie_scenario_browser">Браўзер</string>
|
||||
<string name="mdnie_scenario_tdmb">Лічбавае тэлебачанне</string>
|
||||
<string name="mdnie_accessibility_normal">Звычайны</string>
|
||||
<string name="mdnie_accessibility_inverse">Інвертаваны</string>
|
||||
<string name="mdnie_accessibility_color_blind">Дальтанізм</string>
|
||||
<string name="mdnie_accessibility_grayscale">Шэры</string>
|
||||
|
||||
@@ -33,12 +33,5 @@
|
||||
<string name="mdnie_scenario_vt">Videollamada</string>
|
||||
<string name="mdnie_scenario_browser">Navegador</string>
|
||||
<string name="mdnie_scenario_ebook">Libro electrónico</string>
|
||||
<string name="mdnie_scenario_email">Correo electrónico</string>
|
||||
<string name="mdnie_scenario_tdmb">Televisión digital</string>
|
||||
<string name="mdnie_accessibility_normal">Normal</string>
|
||||
<string name="mdnie_accessibility_inverse">Invertido</string>
|
||||
<string name="mdnie_accessibility_color_blind">Daltonismo</string>
|
||||
<string name="mdnie_accessibility_screen_curtain">Cortina de pantalla</string>
|
||||
<string name="mdnie_accessibility_grayscale">Gris</string>
|
||||
<string name="mdnie_accessibility_gray_negative">Gris invertido</string>
|
||||
</resources>
|
||||
|
||||
@@ -21,24 +21,4 @@
|
||||
<string name="screen_colors_title">رنگها</string>
|
||||
<string name="mdnie_scenario_title_head">خط مشی</string>
|
||||
<string name="mdnie_scenario_summary_head">تنظیم خط مشی mDNIe</string>
|
||||
<string name="mdnie_accessibility_title_head">حالت دسترسی</string>
|
||||
<string name="mdnie_accessibility_summary_head">تنظیم حالت دسترسی mDNIe</string>
|
||||
<string name="mdnie_scenario_ui">LineageOS (پیش فرض)</string>
|
||||
<string name="mdnie_scenario_video">ویدئو</string>
|
||||
<string name="mdnie_scenario_video_warm">ویدئو گرم</string>
|
||||
<string name="mdnie_scenario_video_cold">ویدئو سرد</string>
|
||||
<string name="mdnie_scenario_camera">دوربین</string>
|
||||
<string name="mdnie_scenario_navigation">پیمایش</string>
|
||||
<string name="mdnie_scenario_gallery">گالری</string>
|
||||
<string name="mdnie_scenario_vt">تماس تصویری</string>
|
||||
<string name="mdnie_scenario_browser">مرورگر</string>
|
||||
<string name="mdnie_scenario_ebook">کتاب</string>
|
||||
<string name="mdnie_scenario_email">ایمیل</string>
|
||||
<string name="mdnie_scenario_tdmb">تلویزیون دیجیتال</string>
|
||||
<string name="mdnie_accessibility_normal">عادی</string>
|
||||
<string name="mdnie_accessibility_inverse">معکوس</string>
|
||||
<string name="mdnie_accessibility_color_blind">کور رنگی</string>
|
||||
<string name="mdnie_accessibility_screen_curtain">پرده صفحه نمایش</string>
|
||||
<string name="mdnie_accessibility_grayscale">خاکستری</string>
|
||||
<string name="mdnie_accessibility_gray_negative">خاکستری معکوس</string>
|
||||
</resources>
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2012-2014 The CyanogenMod Project
|
||||
Copyright (C) 2018 The LineageOS Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<string name="app_name">Taispeáint chun cinn</string>
|
||||
<string name="category_screen_title">Scáileán</string>
|
||||
<string name="screen_colors_title">Dathanna</string>
|
||||
<string name="mdnie_scenario_title_head">Cás</string>
|
||||
<string name="mdnie_scenario_summary_head">Socraigh an cás mDNIe</string>
|
||||
<string name="mdnie_accessibility_title_head">Mód inrochtaineachta</string>
|
||||
<string name="mdnie_accessibility_summary_head">Socraigh modh inrochtaineachta mDNIe</string>
|
||||
<string name="mdnie_scenario_ui">LineageOS (réamhshocraithe)</string>
|
||||
<string name="mdnie_scenario_video">Físeán</string>
|
||||
<string name="mdnie_scenario_video_warm">Físeán te</string>
|
||||
<string name="mdnie_scenario_video_cold">Físeán fuar</string>
|
||||
<string name="mdnie_scenario_camera">Ceamara</string>
|
||||
<string name="mdnie_scenario_navigation">Loingseoireacht</string>
|
||||
<string name="mdnie_scenario_gallery">Gailearaí</string>
|
||||
<string name="mdnie_scenario_vt">Glao físe</string>
|
||||
<string name="mdnie_scenario_browser">Brabhsálaí</string>
|
||||
<string name="mdnie_scenario_ebook">r-leabhar</string>
|
||||
<string name="mdnie_scenario_email">R-phost</string>
|
||||
<string name="mdnie_scenario_tdmb">Teilifís dhigiteach</string>
|
||||
<string name="mdnie_accessibility_normal">Gnáth</string>
|
||||
<string name="mdnie_accessibility_inverse">Inbhéartaithe</string>
|
||||
<string name="mdnie_accessibility_color_blind">Dath dall</string>
|
||||
<string name="mdnie_accessibility_screen_curtain">Cuirtín scáileáin</string>
|
||||
<string name="mdnie_accessibility_grayscale">Liath</string>
|
||||
<string name="mdnie_accessibility_gray_negative">Liath inbhéartaithe</string>
|
||||
</resources>
|
||||
@@ -22,7 +22,6 @@
|
||||
<string name="mdnie_scenario_title_head">תרחיש</string>
|
||||
<string name="mdnie_scenario_summary_head">הגדר תרחיש mDNIe</string>
|
||||
<string name="mdnie_accessibility_title_head">מצב נגישות</string>
|
||||
<string name="mdnie_accessibility_summary_head">הגדרת מצב הנגישות mDNIe</string>
|
||||
<string name="mdnie_scenario_ui">LineageOS (ברירת מחדל)</string>
|
||||
<string name="mdnie_scenario_video">וידאו</string>
|
||||
<string name="mdnie_scenario_video_warm">וידאו חם</string>
|
||||
@@ -38,7 +37,4 @@
|
||||
<string name="mdnie_accessibility_normal">רגיל</string>
|
||||
<string name="mdnie_accessibility_inverse">הפוך</string>
|
||||
<string name="mdnie_accessibility_color_blind">עיוור צבעים</string>
|
||||
<string name="mdnie_accessibility_screen_curtain">וילון מסך</string>
|
||||
<string name="mdnie_accessibility_grayscale">אפור</string>
|
||||
<string name="mdnie_accessibility_gray_negative">אפור הפוך</string>
|
||||
</resources>
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
<string name="category_screen_title">Tela</string>
|
||||
<string name="screen_colors_title">Cores</string>
|
||||
<string name="mdnie_scenario_title_head">Cenário</string>
|
||||
<string name="mdnie_scenario_summary_head">Configure o cenário mDNIe</string>
|
||||
<string name="mdnie_scenario_summary_head">Defina o cenário mDNIe</string>
|
||||
<string name="mdnie_accessibility_title_head">Modo de acessibilidade</string>
|
||||
<string name="mdnie_accessibility_summary_head">Configure o modo de acessibilidade do mDNIe</string>
|
||||
<string name="mdnie_accessibility_summary_head">Definir o modo de acessibilidade do mDNIe</string>
|
||||
<string name="mdnie_scenario_ui">LineageOS (padrão)</string>
|
||||
<string name="mdnie_scenario_video">Vídeo</string>
|
||||
<string name="mdnie_scenario_video_warm">Vídeo quente</string>
|
||||
@@ -32,9 +32,9 @@
|
||||
<string name="mdnie_scenario_gallery">Galeria</string>
|
||||
<string name="mdnie_scenario_vt">Chamada de vídeo</string>
|
||||
<string name="mdnie_scenario_browser">Navegador</string>
|
||||
<string name="mdnie_scenario_ebook">eBook</string>
|
||||
<string name="mdnie_scenario_ebook">e-book</string>
|
||||
<string name="mdnie_scenario_email">E-mail</string>
|
||||
<string name="mdnie_scenario_tdmb">TV digital</string>
|
||||
<string name="mdnie_scenario_tdmb">Televisão digital</string>
|
||||
<string name="mdnie_accessibility_normal">Normal</string>
|
||||
<string name="mdnie_accessibility_inverse">Invertido</string>
|
||||
<string name="mdnie_accessibility_color_blind">Daltônico</string>
|
||||
|
||||
@@ -16,27 +16,7 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<string name="app_name">Ischermu avantzadu</string>
|
||||
<string name="category_screen_title">Ischermu</string>
|
||||
<string name="screen_colors_title">Colores</string>
|
||||
<string name="mdnie_accessibility_title_head">Modalidade de atzessu fatzilitadu</string>
|
||||
<string name="mdnie_accessibility_summary_head">Cunfigura sa modalidade de atzessu fatzilitadu mDNIe</string>
|
||||
<string name="mdnie_scenario_ui">LineageOS (predefinidu)</string>
|
||||
<string name="mdnie_scenario_video">Vìdeu</string>
|
||||
<string name="mdnie_scenario_video_warm">Tonu vìdeu callente</string>
|
||||
<string name="mdnie_scenario_video_cold">Tonu vìdeu fritu</string>
|
||||
<string name="mdnie_scenario_camera">Càmera</string>
|
||||
<string name="mdnie_scenario_navigation">Navigatzione</string>
|
||||
<string name="mdnie_scenario_gallery">Galleria</string>
|
||||
<string name="mdnie_scenario_vt">Mutida de vìdeu</string>
|
||||
<string name="mdnie_scenario_browser">Navigadore</string>
|
||||
<string name="mdnie_scenario_ebook">Libru electrònicu</string>
|
||||
<string name="mdnie_scenario_email">Posta eletrònica</string>
|
||||
<string name="mdnie_scenario_tdmb">Televisione digitale</string>
|
||||
<string name="mdnie_accessibility_normal">Normale</string>
|
||||
<string name="mdnie_accessibility_inverse">Invertidu</string>
|
||||
<string name="mdnie_accessibility_color_blind">Modalidade daltònica</string>
|
||||
<string name="mdnie_accessibility_screen_curtain">Modalidade ischermu iscuru</string>
|
||||
<string name="mdnie_accessibility_grayscale">Murru</string>
|
||||
<string name="mdnie_accessibility_gray_negative">Murru invertidu</string>
|
||||
</resources>
|
||||
|
||||
@@ -21,17 +21,4 @@
|
||||
<string name="screen_colors_title">நிறங்கள்</string>
|
||||
<string name="mdnie_scenario_title_head">சூழ்நிலை</string>
|
||||
<string name="mdnie_scenario_summary_head">mDNIe சூழ்நிலையை அமை</string>
|
||||
<string name="mdnie_scenario_ui">LineageOS (இயல்புநிலை)</string>
|
||||
<string name="mdnie_scenario_video">காணொளி</string>
|
||||
<string name="mdnie_scenario_camera">படமி</string>
|
||||
<string name="mdnie_scenario_gallery">தொகுப்பு</string>
|
||||
<string name="mdnie_scenario_vt">ஒளி அழைப்பு</string>
|
||||
<string name="mdnie_scenario_browser">உலாவி</string>
|
||||
<string name="mdnie_scenario_ebook">மின்னூல்</string>
|
||||
<string name="mdnie_scenario_email">மின்னஞ்சல்</string>
|
||||
<string name="mdnie_scenario_tdmb"> எண்முறை தொலைக்காட்சி</string>
|
||||
<string name="mdnie_accessibility_normal">இயல்பு</string>
|
||||
<string name="mdnie_accessibility_color_blind">நிறக்குருடு</string>
|
||||
<string name="mdnie_accessibility_screen_curtain">திரை மறைப்பு</string>
|
||||
<string name="mdnie_accessibility_grayscale">சாம்பல்நிறம்</string>
|
||||
</resources>
|
||||
|
||||
@@ -21,24 +21,4 @@
|
||||
<string name="screen_colors_title">رەڭلەر</string>
|
||||
<string name="mdnie_scenario_title_head">كۆرۈنۈش</string>
|
||||
<string name="mdnie_scenario_summary_head">mDNIe لايىھە تەڭشىكى</string>
|
||||
<string name="mdnie_accessibility_title_head">ئاجىزلار ھالىتى</string>
|
||||
<string name="mdnie_accessibility_summary_head">mDNIe نى ئاجىزلار ھالىتىگە تەڭشەيدۇ</string>
|
||||
<string name="mdnie_scenario_ui">LineageOS (كۆڭۈلدىكى)</string>
|
||||
<string name="mdnie_scenario_video">سىن</string>
|
||||
<string name="mdnie_scenario_video_warm">سىن ئىسسىق</string>
|
||||
<string name="mdnie_scenario_video_cold">سىن سوغۇق</string>
|
||||
<string name="mdnie_scenario_camera">كامېرا</string>
|
||||
<string name="mdnie_scenario_navigation">يولباشچى</string>
|
||||
<string name="mdnie_scenario_gallery">سۈرەتدان</string>
|
||||
<string name="mdnie_scenario_vt">سىن چاقىرىش</string>
|
||||
<string name="mdnie_scenario_browser">تور كۆرگۈچ</string>
|
||||
<string name="mdnie_scenario_ebook">ئې-كىتاب</string>
|
||||
<string name="mdnie_scenario_email">ئېلخەت</string>
|
||||
<string name="mdnie_scenario_tdmb">رەقەملىك تېلېۋىزور</string>
|
||||
<string name="mdnie_accessibility_normal">ئادەتتىكى</string>
|
||||
<string name="mdnie_accessibility_inverse">تەتۈر</string>
|
||||
<string name="mdnie_accessibility_color_blind">رەڭ قارىغۇسى</string>
|
||||
<string name="mdnie_accessibility_screen_curtain">ئېكران توسۇش</string>
|
||||
<string name="mdnie_accessibility_grayscale">كۈلرەڭ</string>
|
||||
<string name="mdnie_accessibility_gray_negative">ئەكسى كۈلرەڭ</string>
|
||||
</resources>
|
||||
|
||||
@@ -25,7 +25,7 @@ public class AdvancedDisplayActivity extends CollapsingToolbarBaseActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
getSupportFragmentManager().beginTransaction().replace(
|
||||
getFragmentManager().beginTransaction().replace(
|
||||
com.android.settingslib.collapsingtoolbar.R.id.content_frame,
|
||||
new AdvancedDisplayFragment()).commit();
|
||||
}
|
||||
|
||||
@@ -19,19 +19,19 @@ package org.lineageos.settings.device;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import androidx.preference.PreferenceFragment;
|
||||
|
||||
import org.lineageos.settings.device.R;
|
||||
|
||||
import org.lineageos.internal.util.FileUtils;
|
||||
|
||||
public class AdvancedDisplayFragment extends PreferenceFragmentCompat {
|
||||
public class AdvancedDisplayFragment extends PreferenceFragment {
|
||||
private mDNIeScenario mmDNIeScenario;
|
||||
private mDNIeAccessibility mmDNIeAccessibility;
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
setPreferencesFromResource(R.xml.screen_preferences, rootKey);
|
||||
addPreferencesFromResource(R.xml.screen_preferences);
|
||||
Resources res = getResources();
|
||||
|
||||
/* mDNIe */
|
||||
|
||||
43
Android.mk
Normal file
43
Android.mk
Normal file
@@ -0,0 +1,43 @@
|
||||
# Copyright (C) 2012 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
SAM_ROOT := $(call my-dir)
|
||||
|
||||
# Exynos 4
|
||||
ifeq ($(TARGET_BOARD_PLATFORM),exynos4)
|
||||
ifeq ($(TARGET_SOC),exynos4210)
|
||||
include $(SAM_ROOT)/exynos4210.mk
|
||||
endif
|
||||
ifeq ($(TARGET_SOC),exynos4x12)
|
||||
include $(SAM_ROOT)/exynos4x12.mk
|
||||
endif
|
||||
endif
|
||||
|
||||
# Exynos 3
|
||||
ifeq ($(TARGET_BOARD_PLATFORM),s5pc110)
|
||||
include $(SAM_ROOT)/s5pc110.mk
|
||||
endif
|
||||
|
||||
# Wifi
|
||||
ifeq ($(BOARD_HAVE_SAMSUNG_WIFI),true)
|
||||
include $(SAM_ROOT)/macloader/Android.mk
|
||||
include $(SAM_ROOT)/wifiloader/Android.mk
|
||||
endif
|
||||
|
||||
ifeq ($(BOARD_VENDOR),samsung)
|
||||
include $(SAM_ROOT)/audio/Android.mk
|
||||
include $(SAM_ROOT)/hidl/Android.mk
|
||||
include $(SAM_ROOT)/modemloader/Android.mk
|
||||
include $(SAM_ROOT)/ril/Android.mk
|
||||
endif
|
||||
@@ -1,15 +1,10 @@
|
||||
//
|
||||
// SPDX-FileCopyrightText: 2024-2026 The LineageOS Project
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
cc_library_static {
|
||||
name: "android.hardware.camera.common-helper.samsung",
|
||||
vendor_available: true,
|
||||
defaults: [
|
||||
"hidl_defaults",
|
||||
"samsung_camera3_defaults",
|
||||
],
|
||||
vendor_available: true,
|
||||
srcs: [
|
||||
"CameraModule.cpp",
|
||||
"CameraMetadata.cpp",
|
||||
@@ -35,9 +30,14 @@ cc_library_static {
|
||||
],
|
||||
include_dirs: ["system/media/private/camera/include"],
|
||||
header_libs: ["libhardware_headers.camera3_samsung"],
|
||||
export_include_dirs: [
|
||||
"include",
|
||||
"include_samsung",
|
||||
],
|
||||
export_include_dirs: ["include", "include_samsung"],
|
||||
export_shared_lib_headers: ["libui"],
|
||||
}
|
||||
|
||||
// NOTE: Deprecated module kept for compatibility reasons.
|
||||
// Depend on "android.hardware.camera.common-helper.samsung" instead
|
||||
cc_library_static {
|
||||
name: "android.hardware.camera.common@1.0-helper.samsung",
|
||||
vendor_available: true,
|
||||
whole_static_libs: ["android.hardware.camera.common-helper.samsung"],
|
||||
}
|
||||
|
||||
@@ -66,16 +66,13 @@ ndk::ScopedAStatus CameraDevice::getCameraCharacteristics(CameraMetadata* _aidl_
|
||||
struct camera_info info;
|
||||
int ret = mModule->getCameraInfo(mCameraIdInt, &info);
|
||||
if (ret == OK && info.static_camera_characteristics != NULL) {
|
||||
common::helper::CameraMetadata metadata =
|
||||
(camera_metadata_t*)info.static_camera_characteristics;
|
||||
common::helper::CameraMetadata metadata = (camera_metadata_t*)info.static_camera_characteristics;
|
||||
camera_metadata_entry_t entry = metadata.find(ANDROID_FLASH_INFO_AVAILABLE);
|
||||
if (entry.count > 0 && *entry.data.u8 != 0 &&
|
||||
mModule->isSetTorchModeStrengthSupported()) {
|
||||
if (entry.count > 0 && *entry.data.u8 != 0 && mModule->isSetTorchModeStrengthSupported()) {
|
||||
// Samsung always has 5 supported torch strength levels
|
||||
int32_t defaultTorchStrength = 1;
|
||||
int32_t torchStrengthLevels = 5;
|
||||
metadata.update(ANDROID_FLASH_INFO_STRENGTH_DEFAULT_LEVEL, &defaultTorchStrength,
|
||||
1);
|
||||
metadata.update(ANDROID_FLASH_INFO_STRENGTH_DEFAULT_LEVEL, &defaultTorchStrength, 1);
|
||||
metadata.update(ANDROID_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL, &torchStrengthLevels, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -395,7 +395,7 @@ void CameraDeviceSession::cleanupInflightFences(std::vector<int>& allFences, siz
|
||||
|
||||
CameraDeviceSession::ResultBatcher::ResultBatcher(
|
||||
const std::shared_ptr<ICameraDeviceCallback>& callback)
|
||||
: mCallback(callback) {};
|
||||
: mCallback(callback){};
|
||||
|
||||
bool CameraDeviceSession::ResultBatcher::InflightBatch::allDelivered() const {
|
||||
if (!mShutterDelivered) return false;
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
//
|
||||
// SPDX-FileCopyrightText: 2024-2026 The LineageOS Project
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
soong_config_module_type {
|
||||
name: "samsung_camera3",
|
||||
module_type: "cc_defaults",
|
||||
|
||||
@@ -1573,6 +1573,7 @@ typedef enum camera3_stream_configuration_mode {
|
||||
* types) see the usage field below.
|
||||
*/
|
||||
typedef struct camera3_stream {
|
||||
|
||||
/*****
|
||||
* Set by framework before configure_streams()
|
||||
*/
|
||||
@@ -1673,7 +1674,7 @@ typedef struct camera3_stream {
|
||||
* A handle to HAL-private information for the stream. Will not be inspected
|
||||
* by the framework code.
|
||||
*/
|
||||
void* priv;
|
||||
void *priv;
|
||||
|
||||
/**
|
||||
* A field that describes the contents of the buffer. The format and buffer
|
||||
@@ -1759,7 +1760,7 @@ typedef struct camera3_stream {
|
||||
const char* physical_camera_id;
|
||||
|
||||
/* reserved for future use */
|
||||
void* reserved[6];
|
||||
void *reserved[6];
|
||||
|
||||
#ifdef CAMERA_NEEDS_SEC_RESERVED_FIELD
|
||||
char reserved_sec[0x28];
|
||||
@@ -1792,7 +1793,7 @@ typedef struct camera3_stream_configuration {
|
||||
* At least one output-capable stream must be defined (OUTPUT or
|
||||
* BIDIRECTIONAL).
|
||||
*/
|
||||
camera3_stream_t** streams;
|
||||
camera3_stream_t **streams;
|
||||
|
||||
/**
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_3:
|
||||
@@ -1820,7 +1821,7 @@ typedef struct camera3_stream_configuration {
|
||||
* the parameter values and configure its internal camera pipeline
|
||||
* accordingly.
|
||||
*/
|
||||
const camera_metadata_t* session_parameters;
|
||||
const camera_metadata_t *session_parameters;
|
||||
} camera3_stream_configuration_t;
|
||||
|
||||
/**
|
||||
@@ -1857,12 +1858,12 @@ typedef struct camera3_stream_buffer {
|
||||
/**
|
||||
* The handle of the stream this buffer is associated with
|
||||
*/
|
||||
camera3_stream_t* stream;
|
||||
camera3_stream_t *stream;
|
||||
|
||||
/**
|
||||
* The native handle to the buffer
|
||||
*/
|
||||
buffer_handle_t* buffer;
|
||||
buffer_handle_t *buffer;
|
||||
|
||||
/**
|
||||
* Current state of the buffer, one of the camera3_buffer_status_t
|
||||
@@ -1898,7 +1899,7 @@ typedef struct camera3_stream_buffer {
|
||||
* fences should be handled similarly to the way they are handled for output
|
||||
* buffers.
|
||||
*/
|
||||
int acquire_fence;
|
||||
int acquire_fence;
|
||||
|
||||
/**
|
||||
* The release sync fence for this buffer. The HAL must set this fence when
|
||||
@@ -1946,7 +1947,7 @@ typedef struct camera3_stream_buffer_set {
|
||||
/**
|
||||
* The stream handle for the stream these buffers belong to
|
||||
*/
|
||||
camera3_stream_t* stream;
|
||||
camera3_stream_t *stream;
|
||||
|
||||
/**
|
||||
* The number of buffers in this stream. It is guaranteed to be at least
|
||||
@@ -1960,7 +1961,7 @@ typedef struct camera3_stream_buffer_set {
|
||||
* should inspect the passed-in buffers to determine any platform-private
|
||||
* pixel format information.
|
||||
*/
|
||||
buffer_handle_t** buffers;
|
||||
buffer_handle_t **buffers;
|
||||
|
||||
} camera3_stream_buffer_set_t;
|
||||
|
||||
@@ -2104,7 +2105,7 @@ typedef struct camera3_error_msg {
|
||||
* Pointer to the stream that had a failure. NULL if the stream isn't
|
||||
* applicable to the error.
|
||||
*/
|
||||
camera3_stream_t* error_stream;
|
||||
camera3_stream_t *error_stream;
|
||||
|
||||
/**
|
||||
* The code for this error; one of the CAMERA_MSG_ERROR enum values.
|
||||
@@ -2139,6 +2140,7 @@ typedef struct camera3_shutter_msg {
|
||||
* The message structure sent to camera3_callback_ops_t.notify()
|
||||
*/
|
||||
typedef struct camera3_notify_msg {
|
||||
|
||||
/**
|
||||
* The message type. One of camera3_notify_msg_type, or a private extension.
|
||||
*/
|
||||
@@ -2164,6 +2166,7 @@ typedef struct camera3_notify_msg {
|
||||
|
||||
} camera3_notify_msg_t;
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* Types definition for request_stream_buffers() callback.
|
||||
@@ -2275,7 +2278,7 @@ typedef struct camera3_buffer_request {
|
||||
/**
|
||||
* The stream HAL wants to request buffer from
|
||||
*/
|
||||
camera3_stream_t* stream;
|
||||
camera3_stream_t *stream;
|
||||
|
||||
/**
|
||||
* The number of buffers HAL requested
|
||||
@@ -2287,7 +2290,7 @@ typedef struct camera3_stream_buffer_ret {
|
||||
/**
|
||||
* The stream HAL wants to request buffer from
|
||||
*/
|
||||
camera3_stream_t* stream;
|
||||
camera3_stream_t *stream;
|
||||
|
||||
/**
|
||||
* The status of buffer request of this stream
|
||||
@@ -2306,9 +2309,10 @@ typedef struct camera3_stream_buffer_ret {
|
||||
* Caller of request_stream_buffers() should supply this with enough memory
|
||||
* (num_buffers_requested * sizeof(camera3_stream_buffer_t))
|
||||
*/
|
||||
camera3_stream_buffer_t* output_buffers;
|
||||
camera3_stream_buffer_t *output_buffers;
|
||||
} camera3_stream_buffer_ret_t;
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* Capture request/result definitions for the HAL process_capture_request()
|
||||
@@ -2406,7 +2410,7 @@ typedef struct camera3_capture_request {
|
||||
* NULL buffer cannot be used as the first submitted request after a
|
||||
* configure_streams() call.
|
||||
*/
|
||||
const camera_metadata_t* settings;
|
||||
const camera_metadata_t *settings;
|
||||
|
||||
/**
|
||||
* The input stream buffer to use for this request, if any.
|
||||
@@ -2432,7 +2436,7 @@ typedef struct camera3_capture_request {
|
||||
* The buffers will not have been pre-registered with the HAL.
|
||||
* Subsequent requests may reuse buffers, or provide entirely new buffers.
|
||||
*/
|
||||
camera3_stream_buffer_t* input_buffer;
|
||||
camera3_stream_buffer_t *input_buffer;
|
||||
|
||||
/**
|
||||
* The number of output buffers for this capture request. Must be at least
|
||||
@@ -2459,7 +2463,7 @@ typedef struct camera3_capture_request {
|
||||
* Any or all of the buffers included here may be brand new in this
|
||||
* request (having never before seen by the HAL).
|
||||
*/
|
||||
const camera3_stream_buffer_t* output_buffers;
|
||||
const camera3_stream_buffer_t *output_buffers;
|
||||
|
||||
/**
|
||||
* <= CAMERA_DEVICE_API_VERISON_3_4:
|
||||
@@ -2484,7 +2488,7 @@ typedef struct camera3_capture_request {
|
||||
* In case some id is invalid, the process capture request must fail and return
|
||||
* -EINVAL.
|
||||
*/
|
||||
const char** physcam_id;
|
||||
const char **physcam_id;
|
||||
|
||||
/**
|
||||
* <= CAMERA_DEVICE_API_VERISON_3_4:
|
||||
@@ -2497,7 +2501,7 @@ typedef struct camera3_capture_request {
|
||||
* case the settings at some particular index are empty, the process capture
|
||||
* request must fail and return -EINVAL.
|
||||
*/
|
||||
const camera_metadata_t** physcam_settings;
|
||||
const camera_metadata_t **physcam_settings;
|
||||
|
||||
} camera3_capture_request_t;
|
||||
|
||||
@@ -2550,7 +2554,7 @@ typedef struct camera3_capture_result {
|
||||
* submitted request to uniquely identify this capture. It is also used to
|
||||
* identify the request in asynchronous notifications sent to
|
||||
* camera3_callback_ops_t.notify().
|
||||
*/
|
||||
*/
|
||||
uint32_t frame_number;
|
||||
|
||||
/**
|
||||
@@ -2578,7 +2582,7 @@ typedef struct camera3_capture_result {
|
||||
* If notify has been called with ERROR_RESULT, all further partial
|
||||
* results for that frame are ignored by the framework.
|
||||
*/
|
||||
const camera_metadata_t* result;
|
||||
const camera_metadata_t *result;
|
||||
|
||||
/**
|
||||
* The number of output buffers returned in this result structure. Must be
|
||||
@@ -2628,84 +2632,84 @@ typedef struct camera3_capture_result {
|
||||
* via a SHUTTER notify() call. It is highly recommended to
|
||||
* dispatch that call as early as possible.
|
||||
*/
|
||||
const camera3_stream_buffer_t* output_buffers;
|
||||
const camera3_stream_buffer_t *output_buffers;
|
||||
|
||||
/**
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_2:
|
||||
*
|
||||
* The handle for the input stream buffer for this capture. It may not
|
||||
* yet be consumed at the time the HAL calls process_capture_result(); the
|
||||
* framework will wait on the release sync fences provided by the HAL before
|
||||
* reusing the buffer.
|
||||
*
|
||||
* The HAL should handle the sync fences the same way they are done for
|
||||
* output_buffers.
|
||||
*
|
||||
* Only one input buffer is allowed to be sent per request. Similarly to
|
||||
* output buffers, the ordering of returned input buffers must be
|
||||
* maintained by the HAL.
|
||||
*
|
||||
* Performance considerations:
|
||||
*
|
||||
* The input buffer should be returned as early as possible. If the HAL
|
||||
* supports sync fences, it can call process_capture_result to hand it back
|
||||
* with sync fences being set appropriately. If the sync fences are not
|
||||
* supported, the buffer can only be returned when it is consumed, which
|
||||
* may take long time; the HAL may choose to copy this input buffer to make
|
||||
* the buffer return sooner.
|
||||
*/
|
||||
const camera3_stream_buffer_t* input_buffer;
|
||||
/**
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_2:
|
||||
*
|
||||
* The handle for the input stream buffer for this capture. It may not
|
||||
* yet be consumed at the time the HAL calls process_capture_result(); the
|
||||
* framework will wait on the release sync fences provided by the HAL before
|
||||
* reusing the buffer.
|
||||
*
|
||||
* The HAL should handle the sync fences the same way they are done for
|
||||
* output_buffers.
|
||||
*
|
||||
* Only one input buffer is allowed to be sent per request. Similarly to
|
||||
* output buffers, the ordering of returned input buffers must be
|
||||
* maintained by the HAL.
|
||||
*
|
||||
* Performance considerations:
|
||||
*
|
||||
* The input buffer should be returned as early as possible. If the HAL
|
||||
* supports sync fences, it can call process_capture_result to hand it back
|
||||
* with sync fences being set appropriately. If the sync fences are not
|
||||
* supported, the buffer can only be returned when it is consumed, which
|
||||
* may take long time; the HAL may choose to copy this input buffer to make
|
||||
* the buffer return sooner.
|
||||
*/
|
||||
const camera3_stream_buffer_t *input_buffer;
|
||||
|
||||
/**
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_2:
|
||||
*
|
||||
* In order to take advantage of partial results, the HAL must set the
|
||||
* static metadata android.request.partialResultCount to the number of
|
||||
* partial results it will send for each frame.
|
||||
*
|
||||
* Each new capture result with a partial result must set
|
||||
* this field (partial_result) to a distinct inclusive value between
|
||||
* 1 and android.request.partialResultCount.
|
||||
*
|
||||
* HALs not wishing to take advantage of this feature must not
|
||||
* set an android.request.partialResultCount or partial_result to a value
|
||||
* other than 1.
|
||||
*
|
||||
* This value must be set to 0 when a capture result contains buffers only
|
||||
* and no metadata.
|
||||
*/
|
||||
uint32_t partial_result;
|
||||
/**
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_2:
|
||||
*
|
||||
* In order to take advantage of partial results, the HAL must set the
|
||||
* static metadata android.request.partialResultCount to the number of
|
||||
* partial results it will send for each frame.
|
||||
*
|
||||
* Each new capture result with a partial result must set
|
||||
* this field (partial_result) to a distinct inclusive value between
|
||||
* 1 and android.request.partialResultCount.
|
||||
*
|
||||
* HALs not wishing to take advantage of this feature must not
|
||||
* set an android.request.partialResultCount or partial_result to a value
|
||||
* other than 1.
|
||||
*
|
||||
* This value must be set to 0 when a capture result contains buffers only
|
||||
* and no metadata.
|
||||
*/
|
||||
uint32_t partial_result;
|
||||
|
||||
/**
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_5:
|
||||
*
|
||||
* Specifies the number of physical camera metadata this capture result
|
||||
* contains. It must be equal to the number of physical cameras being
|
||||
* requested from.
|
||||
*
|
||||
* If the current camera device is not a logical multi-camera, or the
|
||||
* corresponding capture_request doesn't request on any physical camera,
|
||||
* this field must be 0.
|
||||
*/
|
||||
uint32_t num_physcam_metadata;
|
||||
/**
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_5:
|
||||
*
|
||||
* Specifies the number of physical camera metadata this capture result
|
||||
* contains. It must be equal to the number of physical cameras being
|
||||
* requested from.
|
||||
*
|
||||
* If the current camera device is not a logical multi-camera, or the
|
||||
* corresponding capture_request doesn't request on any physical camera,
|
||||
* this field must be 0.
|
||||
*/
|
||||
uint32_t num_physcam_metadata;
|
||||
|
||||
/**
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_5:
|
||||
*
|
||||
* An array of strings containing the physical camera ids for the returned
|
||||
* physical camera metadata. The length of the array is
|
||||
* num_physcam_metadata.
|
||||
*/
|
||||
const char** physcam_ids;
|
||||
/**
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_5:
|
||||
*
|
||||
* An array of strings containing the physical camera ids for the returned
|
||||
* physical camera metadata. The length of the array is
|
||||
* num_physcam_metadata.
|
||||
*/
|
||||
const char **physcam_ids;
|
||||
|
||||
/**
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_5:
|
||||
*
|
||||
* The array of physical camera metadata for the physical cameras being
|
||||
* requested upon. This array should have a 1-to-1 mapping with the
|
||||
* physcam_ids. The length of the array is num_physcam_metadata.
|
||||
*/
|
||||
const camera_metadata_t** physcam_metadata;
|
||||
/**
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_5:
|
||||
*
|
||||
* The array of physical camera metadata for the physical cameras being
|
||||
* requested upon. This array should have a 1-to-1 mapping with the
|
||||
* physcam_ids. The length of the array is num_physcam_metadata.
|
||||
*/
|
||||
const camera_metadata_t **physcam_metadata;
|
||||
|
||||
} camera3_capture_result_t;
|
||||
|
||||
@@ -2722,6 +2726,7 @@ typedef struct camera3_capture_result {
|
||||
*
|
||||
*/
|
||||
typedef struct camera3_callback_ops {
|
||||
|
||||
/**
|
||||
* process_capture_result:
|
||||
*
|
||||
@@ -2789,8 +2794,8 @@ typedef struct camera3_callback_ops {
|
||||
* 4 frame intervals, and must be less than or equal to 8 frame intervals.
|
||||
*
|
||||
*/
|
||||
void (*process_capture_result)(const struct camera3_callback_ops*,
|
||||
const camera3_capture_result_t* result);
|
||||
void (*process_capture_result)(const struct camera3_callback_ops *,
|
||||
const camera3_capture_result_t *result);
|
||||
|
||||
/**
|
||||
* notify:
|
||||
@@ -2822,7 +2827,8 @@ typedef struct camera3_callback_ops {
|
||||
*
|
||||
* This is a non-blocking call. The framework will return this call in 5ms.
|
||||
*/
|
||||
void (*notify)(const struct camera3_callback_ops*, const camera3_notify_msg_t* msg);
|
||||
void (*notify)(const struct camera3_callback_ops *,
|
||||
const camera3_notify_msg_t *msg);
|
||||
|
||||
/**
|
||||
* request_stream_buffers:
|
||||
@@ -2858,10 +2864,11 @@ typedef struct camera3_callback_ops {
|
||||
* ready to fill the buffer.
|
||||
*/
|
||||
camera3_buffer_request_status_t (*request_stream_buffers)(
|
||||
const struct camera3_callback_ops*, uint32_t num_buffer_reqs,
|
||||
const camera3_buffer_request_t* buffer_reqs,
|
||||
/*out*/ uint32_t* num_returned_buf_reqs,
|
||||
/*out*/ camera3_stream_buffer_ret_t* returned_buf_reqs);
|
||||
const struct camera3_callback_ops *,
|
||||
uint32_t num_buffer_reqs,
|
||||
const camera3_buffer_request_t *buffer_reqs,
|
||||
/*out*/uint32_t *num_returned_buf_reqs,
|
||||
/*out*/camera3_stream_buffer_ret_t *returned_buf_reqs);
|
||||
|
||||
/**
|
||||
* return_stream_buffers:
|
||||
@@ -2877,8 +2884,10 @@ typedef struct camera3_callback_ops {
|
||||
* If this method is called during a configure_streams() call, it will be
|
||||
* blocked until camera service finishes the ongoing configure_streams() call.
|
||||
*/
|
||||
void (*return_stream_buffers)(const struct camera3_callback_ops*, uint32_t num_buffers,
|
||||
const camera3_stream_buffer_t* const* buffers);
|
||||
void (*return_stream_buffers)(
|
||||
const struct camera3_callback_ops *,
|
||||
uint32_t num_buffers,
|
||||
const camera3_stream_buffer_t* const* buffers);
|
||||
|
||||
} camera3_callback_ops_t;
|
||||
|
||||
@@ -2888,6 +2897,7 @@ typedef struct camera3_callback_ops {
|
||||
*
|
||||
*/
|
||||
typedef struct camera3_device_ops {
|
||||
|
||||
/**
|
||||
* initialize:
|
||||
*
|
||||
@@ -2907,7 +2917,8 @@ typedef struct camera3_device_ops {
|
||||
* -ENODEV: If initialization fails. Only close() can be called successfully
|
||||
* by the framework after this.
|
||||
*/
|
||||
int (*initialize)(const struct camera3_device*, const camera3_callback_ops_t* callback_ops);
|
||||
int (*initialize)(const struct camera3_device *,
|
||||
const camera3_callback_ops_t *callback_ops);
|
||||
|
||||
/**********************************************************************
|
||||
* Stream management
|
||||
@@ -3145,8 +3156,8 @@ typedef struct camera3_device_ops {
|
||||
* operational. Only close() can be called successfully by the
|
||||
* framework after this error is returned.
|
||||
*/
|
||||
int (*configure_streams)(const struct camera3_device*,
|
||||
camera3_stream_configuration_t* stream_list);
|
||||
int (*configure_streams)(const struct camera3_device *,
|
||||
camera3_stream_configuration_t *stream_list);
|
||||
|
||||
/**
|
||||
* register_stream_buffers:
|
||||
@@ -3199,8 +3210,8 @@ typedef struct camera3_device_ops {
|
||||
* operational. Only close() can be called successfully by the
|
||||
* framework after this error is returned.
|
||||
*/
|
||||
int (*register_stream_buffers)(const struct camera3_device*,
|
||||
const camera3_stream_buffer_set_t* buffer_set);
|
||||
int (*register_stream_buffers)(const struct camera3_device *,
|
||||
const camera3_stream_buffer_set_t *buffer_set);
|
||||
|
||||
/**********************************************************************
|
||||
* Request creation and submission
|
||||
@@ -3235,8 +3246,9 @@ typedef struct camera3_device_ops {
|
||||
* the close() method can be called successfully by the
|
||||
* framework.
|
||||
*/
|
||||
const camera_metadata_t* (*construct_default_request_settings)(const struct camera3_device*,
|
||||
int type);
|
||||
const camera_metadata_t* (*construct_default_request_settings)(
|
||||
const struct camera3_device *,
|
||||
int type);
|
||||
|
||||
/**
|
||||
* process_capture_request:
|
||||
@@ -3304,8 +3316,8 @@ typedef struct camera3_device_ops {
|
||||
* called by the framework.
|
||||
*
|
||||
*/
|
||||
int (*process_capture_request)(const struct camera3_device*,
|
||||
camera3_capture_request_t* request);
|
||||
int (*process_capture_request)(const struct camera3_device *,
|
||||
camera3_capture_request_t *request);
|
||||
|
||||
/**********************************************************************
|
||||
* Miscellaneous methods
|
||||
@@ -3326,7 +3338,8 @@ typedef struct camera3_device_ops {
|
||||
* NULL by the HAL. Please implement get_vendor_tag_ops in camera_common.h
|
||||
* instead.
|
||||
*/
|
||||
void (*get_metadata_vendor_tag_ops)(const struct camera3_device*, vendor_tag_query_ops_t* ops);
|
||||
void (*get_metadata_vendor_tag_ops)(const struct camera3_device*,
|
||||
vendor_tag_query_ops_t* ops);
|
||||
|
||||
/**
|
||||
* dump:
|
||||
@@ -3346,7 +3359,7 @@ typedef struct camera3_device_ops {
|
||||
* Any synchronization primitives used (such as mutex locks or semaphores)
|
||||
* should be acquired with a timeout.
|
||||
*/
|
||||
void (*dump)(const struct camera3_device*, int fd);
|
||||
void (*dump)(const struct camera3_device *, int fd);
|
||||
|
||||
/**
|
||||
* flush:
|
||||
@@ -3419,10 +3432,10 @@ typedef struct camera3_device_ops {
|
||||
* need to call process_capture_result with NULL metadata or equivalent.
|
||||
*
|
||||
* 4. If a flush() is invoked while a process_capture_request() invocation is active, that
|
||||
* process call should return as soon as possible. In addition, if a
|
||||
* process_capture_request() call is made after flush() has been invoked but before flush() has
|
||||
* returned, the capture request provided by the late process_capture_request call should be
|
||||
* treated like a pending request in case #2 above.
|
||||
* process call should return as soon as possible. In addition, if a process_capture_request()
|
||||
* call is made after flush() has been invoked but before flush() has returned, the
|
||||
* capture request provided by the late process_capture_request call should be treated like
|
||||
* a pending request in case #2 above.
|
||||
*
|
||||
* flush() should only return when there are no more outstanding buffers or
|
||||
* requests left in the HAL. The framework may call configure_streams (as
|
||||
@@ -3452,7 +3465,7 @@ typedef struct camera3_device_ops {
|
||||
* error is returned, only the close() method can be successfully
|
||||
* called by the framework.
|
||||
*/
|
||||
int (*flush)(const struct camera3_device*);
|
||||
int (*flush)(const struct camera3_device *);
|
||||
|
||||
/**
|
||||
* signal_stream_flush:
|
||||
@@ -3474,8 +3487,9 @@ typedef struct camera3_device_ops {
|
||||
* skip calling this if all buffers are already returned.
|
||||
*
|
||||
*/
|
||||
void (*signal_stream_flush)(const struct camera3_device*, uint32_t num_streams,
|
||||
const camera3_stream_t* const* streams);
|
||||
void (*signal_stream_flush)(const struct camera3_device*,
|
||||
uint32_t num_streams,
|
||||
const camera3_stream_t* const* streams);
|
||||
|
||||
/**
|
||||
* is_reconfiguration_required:
|
||||
@@ -3524,11 +3538,11 @@ typedef struct camera3_device_ops {
|
||||
* reconfiguration query.
|
||||
*/
|
||||
int (*is_reconfiguration_required)(const struct camera3_device*,
|
||||
const camera_metadata_t* old_session_params,
|
||||
const camera_metadata_t* new_session_params);
|
||||
const camera_metadata_t* old_session_params,
|
||||
const camera_metadata_t* new_session_params);
|
||||
|
||||
/* reserved for future use */
|
||||
void* reserved[6];
|
||||
void *reserved[6];
|
||||
} camera3_device_ops_t;
|
||||
|
||||
/**********************************************************************
|
||||
@@ -3549,8 +3563,8 @@ typedef struct camera3_device {
|
||||
*
|
||||
*/
|
||||
hw_device_t common;
|
||||
camera3_device_ops_t* ops;
|
||||
void* priv;
|
||||
camera3_device_ops_t *ops;
|
||||
void *priv;
|
||||
} camera3_device_t;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
@@ -19,15 +19,15 @@
|
||||
#ifndef ANDROID_INCLUDE_CAMERA_COMMON_H
|
||||
#define ANDROID_INCLUDE_CAMERA_COMMON_H
|
||||
|
||||
#include <cutils/native_handle.h>
|
||||
#include <hardware/gralloc.h>
|
||||
#include <hardware/hardware.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <cutils/native_handle.h>
|
||||
#include <system/camera.h>
|
||||
#include <system/camera_vendor_tags.h>
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/gralloc.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
@@ -36,11 +36,6 @@ __BEGIN_DECLS
|
||||
*/
|
||||
#define CAMERA_HARDWARE_MODULE_ID "camera"
|
||||
|
||||
/**
|
||||
* The id of Samsung UniHAL module
|
||||
*/
|
||||
#define SEC_CAMERA_HARDWARE_MODULE_ID "camera.unihal"
|
||||
|
||||
/**
|
||||
* Module versioning information for the Camera hardware module, based on
|
||||
* camera_module_t.common.module_api_version. The two most significant hex
|
||||
@@ -162,11 +157,11 @@ __BEGIN_DECLS
|
||||
* All device versions <= HARDWARE_DEVICE_API_VERSION(1, 0xFF) must be treated
|
||||
* as CAMERA_DEVICE_API_VERSION_1_0
|
||||
*/
|
||||
#define CAMERA_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0) // DEPRECATED
|
||||
#define CAMERA_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0) // NO LONGER SUPPORTED
|
||||
#define CAMERA_DEVICE_API_VERSION_2_1 HARDWARE_DEVICE_API_VERSION(2, 1) // NO LONGER SUPPORTED
|
||||
#define CAMERA_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0) // NO LONGER SUPPORTED
|
||||
#define CAMERA_DEVICE_API_VERSION_3_1 HARDWARE_DEVICE_API_VERSION(3, 1) // NO LONGER SUPPORTED
|
||||
#define CAMERA_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0) // DEPRECATED
|
||||
#define CAMERA_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0) // NO LONGER SUPPORTED
|
||||
#define CAMERA_DEVICE_API_VERSION_2_1 HARDWARE_DEVICE_API_VERSION(2, 1) // NO LONGER SUPPORTED
|
||||
#define CAMERA_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0) // NO LONGER SUPPORTED
|
||||
#define CAMERA_DEVICE_API_VERSION_3_1 HARDWARE_DEVICE_API_VERSION(3, 1) // NO LONGER SUPPORTED
|
||||
#define CAMERA_DEVICE_API_VERSION_3_2 HARDWARE_DEVICE_API_VERSION(3, 2)
|
||||
#define CAMERA_DEVICE_API_VERSION_3_3 HARDWARE_DEVICE_API_VERSION(3, 3)
|
||||
#define CAMERA_DEVICE_API_VERSION_3_4 HARDWARE_DEVICE_API_VERSION(3, 4)
|
||||
@@ -262,7 +257,7 @@ typedef struct camera_info {
|
||||
* otherwise.
|
||||
*
|
||||
*/
|
||||
const camera_metadata_t* static_camera_characteristics;
|
||||
const camera_metadata_t *static_camera_characteristics;
|
||||
|
||||
/**
|
||||
* The total resource "cost" of using this camera, represented as an integer
|
||||
@@ -616,6 +611,7 @@ typedef enum torch_mode_status {
|
||||
|
||||
*/
|
||||
typedef struct camera_module_callbacks {
|
||||
|
||||
/**
|
||||
* camera_device_status_change:
|
||||
*
|
||||
@@ -636,8 +632,9 @@ typedef struct camera_module_callbacks {
|
||||
* or a platform-specific status.
|
||||
*
|
||||
*/
|
||||
void (*camera_device_status_change)(const struct camera_module_callbacks*, int camera_id,
|
||||
int new_status);
|
||||
void (*camera_device_status_change)(const struct camera_module_callbacks*,
|
||||
int camera_id,
|
||||
int new_status);
|
||||
|
||||
/**
|
||||
* torch_mode_status_change:
|
||||
@@ -658,8 +655,10 @@ typedef struct camera_module_callbacks {
|
||||
*
|
||||
* new_status: The new status code, one of the torch_mode_status_t enums.
|
||||
*/
|
||||
void (*torch_mode_status_change)(const struct camera_module_callbacks*, const char* camera_id,
|
||||
int new_status);
|
||||
void (*torch_mode_status_change)(const struct camera_module_callbacks*,
|
||||
const char* camera_id,
|
||||
int new_status);
|
||||
|
||||
|
||||
} camera_module_callbacks_t;
|
||||
|
||||
@@ -797,7 +796,7 @@ typedef struct camera_stream_combination {
|
||||
*
|
||||
* At least one output-capable stream must be defined.
|
||||
*/
|
||||
camera_stream_t* streams;
|
||||
camera_stream_t *streams;
|
||||
|
||||
/**
|
||||
* The operation mode of streams in this stream combination, one of the value
|
||||
@@ -907,7 +906,7 @@ typedef struct camera_module {
|
||||
int (*get_number_of_cameras)(void);
|
||||
|
||||
#ifdef CAMERA_NEEDS_SEC_GET_CAM_POS_V1
|
||||
/**
|
||||
/**
|
||||
* get_cam_pos:
|
||||
*
|
||||
* Unknown. Needed by prebuilt camera module from the Samsung GTO device.
|
||||
@@ -946,10 +945,10 @@ typedef struct camera_module {
|
||||
* this method with this invalid camera id will get -EINVAL and NULL camera
|
||||
* static metadata (camera_info.static_camera_characteristics).
|
||||
*/
|
||||
int (*get_camera_info)(int camera_id, struct camera_info* info);
|
||||
int (*get_camera_info)(int camera_id, struct camera_info *info);
|
||||
|
||||
#ifdef CAMERA_NEEDS_SEC_GET_CAM_POS_V2
|
||||
/**
|
||||
/**
|
||||
* get_cam_pos:
|
||||
*
|
||||
* Unknown. Needed by prebuilt camera module from the Samsung GTA4L device.
|
||||
@@ -993,7 +992,7 @@ typedef struct camera_module {
|
||||
* -EINVAL: The input arguments are invalid, i.e. the callbacks are
|
||||
* null
|
||||
*/
|
||||
int (*set_callbacks)(const camera_module_callbacks_t* callbacks);
|
||||
int (*set_callbacks)(const camera_module_callbacks_t *callbacks);
|
||||
|
||||
/**
|
||||
* get_vendor_tag_ops:
|
||||
@@ -1059,8 +1058,8 @@ typedef struct camera_module {
|
||||
* opened concurrently were opened already, either by
|
||||
* this method or common.methods->open method.
|
||||
*/
|
||||
int (*open_legacy)(const struct hw_module_t* module, const char* id, uint32_t halVersion,
|
||||
struct hw_device_t** device);
|
||||
int (*open_legacy)(const struct hw_module_t* module, const char* id,
|
||||
uint32_t halVersion, struct hw_device_t** device);
|
||||
|
||||
/**
|
||||
* set_torch_mode:
|
||||
@@ -1176,7 +1175,8 @@ typedef struct camera_module {
|
||||
* framework. Calling this function with invalid physical_camera_id will
|
||||
* get -EINVAL, and NULL static_metadata.
|
||||
*/
|
||||
int (*get_physical_camera_info)(int physical_camera_id, camera_metadata_t** static_metadata);
|
||||
int (*get_physical_camera_info)(int physical_camera_id,
|
||||
camera_metadata_t **static_metadata);
|
||||
|
||||
/**
|
||||
* is_stream_combination_supported:
|
||||
@@ -1200,7 +1200,7 @@ typedef struct camera_module {
|
||||
* Valid to be called by the framework.
|
||||
*/
|
||||
int (*is_stream_combination_supported)(int camera_id,
|
||||
const camera_stream_combination_t* streams);
|
||||
const camera_stream_combination_t *streams);
|
||||
|
||||
/**
|
||||
* notify_device_state_change:
|
||||
|
||||
@@ -1,18 +1,35 @@
|
||||
//
|
||||
// SPDX-FileCopyrightText: 2024-2026 The LineageOS Project
|
||||
// Copyright (C) 2024 The LineageOS Project
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
soong_config_module_type {
|
||||
name: "extra_ids",
|
||||
module_type: "cc_defaults",
|
||||
config_namespace: "samsungCameraVars",
|
||||
value_variables: ["extra_ids"],
|
||||
properties: ["cppflags"],
|
||||
}
|
||||
|
||||
extra_ids {
|
||||
name: "extra_id_defaults",
|
||||
soong_config_variables: {
|
||||
extra_ids: {
|
||||
cppflags: ["-DEXTRA_IDS=%s"],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
cc_defaults {
|
||||
name: "camera_service_aidl_defaults.samsung",
|
||||
defaults: ["samsung_camera3_defaults"],
|
||||
defaults: [
|
||||
"extra_id_defaults",
|
||||
"samsung_camera3_defaults"
|
||||
],
|
||||
vintf_fragments: ["android.hardware.camera.provider-service.samsung.xml"],
|
||||
vendor: true,
|
||||
relative_install_path: "hw",
|
||||
cppflags: select(soong_config_variable("samsungCameraVars", "extra_ids"), {
|
||||
any @ flag_val: ["-DEXTRA_IDS=" + flag_val],
|
||||
default: [],
|
||||
}),
|
||||
srcs: [
|
||||
"service.cpp",
|
||||
"CameraProvider.cpp",
|
||||
|
||||
@@ -183,13 +183,10 @@ bool CameraProvider::initCamera(int id) {
|
||||
|
||||
bool CameraProvider::initialize() {
|
||||
camera_module_t* rawModule;
|
||||
int err = hw_get_module(SEC_CAMERA_HARDWARE_MODULE_ID, (const hw_module_t**)&rawModule);
|
||||
int err = hw_get_module(CAMERA_HARDWARE_MODULE_ID, (const hw_module_t**)&rawModule);
|
||||
if (err < 0) {
|
||||
err = hw_get_module(CAMERA_HARDWARE_MODULE_ID, (const hw_module_t**)&rawModule);
|
||||
if (err < 0) {
|
||||
ALOGE("Could not load camera HAL module: %d (%s)", err, strerror(-err));
|
||||
return true;
|
||||
}
|
||||
ALOGE("Could not load camera HAL module: %d (%s)", err, strerror(-err));
|
||||
return true;
|
||||
}
|
||||
|
||||
mModule = new SamsungCameraModule(rawModule);
|
||||
@@ -224,7 +221,7 @@ bool CameraProvider::initialize() {
|
||||
}
|
||||
std::vector<int> extraIDs = {
|
||||
#ifdef EXTRA_IDS
|
||||
EXTRA_IDS
|
||||
EXTRA_IDS
|
||||
#endif
|
||||
};
|
||||
for (int i : extraIDs) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
* Copyright (C) 2024-2025 The LineageOS Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,14 +35,14 @@ int main() {
|
||||
ALOGI("CameraProvider: samsung service is starting.");
|
||||
|
||||
ABinderProcess_setThreadPoolMaxThreadCount(HWBINDER_THREAD_COUNT);
|
||||
ABinderProcess_startThreadPool();
|
||||
|
||||
std::shared_ptr<CameraProvider> defaultProvider = ndk::SharedRefBase::make<CameraProvider>();
|
||||
const std::string serviceName = std::string(CameraProvider::descriptor) + "/internal/0";
|
||||
|
||||
binder_exception_t ret =
|
||||
AServiceManager_addService(defaultProvider->asBinder().get(), serviceName.c_str());
|
||||
LOG_ALWAYS_FATAL_IF(ret != EX_NONE, "Error while registering camera provider service: %d", ret);
|
||||
LOG_ALWAYS_FATAL_IF(ret != EX_NONE, "Error while registering camera provider service: %d",
|
||||
ret);
|
||||
|
||||
ABinderProcess_joinThreadPool();
|
||||
return EXIT_FAILURE; // should not reach
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019 The Android Open Source Project
|
||||
* Copyright 2025 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
cc_binary {
|
||||
name: "android.software.media.c2-service.samsung",
|
||||
vendor: true,
|
||||
relative_install_path: "hw",
|
||||
|
||||
init_rc: ["android.software.media.c2-service.samsung.rc"],
|
||||
|
||||
//
|
||||
// default -> For devices that already have a c2@1.2 or c2-V1 service in their vendor (QTI c2, Samsung hardware c2 etc.)
|
||||
// legacy_default0 -> For devices that already have a c2@1.0 service in their vendor (QTI c2, Samsung hardware c2 etc.)
|
||||
// legacy_default -> For devices without a c2 service in their vendor
|
||||
//
|
||||
vintf_fragments: select(soong_config_variable("samsungCodec2Vars", "c2_instance_type"), {
|
||||
any @ fragment: ["samsung_media_c2_" + fragment + ".xml"],
|
||||
default: ["samsung_media_c2_default.xml"],
|
||||
}),
|
||||
|
||||
defaults: [
|
||||
"libcodec2-hidl-defaults",
|
||||
"libcodec2-aidl-defaults",
|
||||
],
|
||||
|
||||
srcs: [
|
||||
"vendor.cpp",
|
||||
],
|
||||
|
||||
// minijail is used to protect against unexpected system calls.
|
||||
shared_libs: [
|
||||
"libavservices_minijail",
|
||||
"libbinder",
|
||||
"libbinder_ndk",
|
||||
] + select(soong_config_variable("samsungCodec2Vars", "target_componentstore_library"), {
|
||||
any @ flag_val: [flag_val],
|
||||
default: [],
|
||||
}),
|
||||
|
||||
cflags: select(soong_config_variable("samsungCodec2Vars", "uses_legacy_component_store"), {
|
||||
"true": ["-DLEGACY_COMPONENT_STORE" ],
|
||||
default: [],
|
||||
}),
|
||||
|
||||
required: ["android.software.media.c2-default-seccomp_policy"],
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "android.software.media.c2-default-seccomp_policy",
|
||||
vendor: true,
|
||||
sub_dir: "seccomp_policy",
|
||||
|
||||
// If a specific architecture is targeted, multiple choices are not needed.
|
||||
arch: {
|
||||
arm: {
|
||||
src: "seccomp_policy/android.software.media.c2-default-arm.policy",
|
||||
},
|
||||
arm64: {
|
||||
src: "seccomp_policy/android.software.media.c2-default-arm64.policy",
|
||||
},
|
||||
riscv64: {
|
||||
src: "seccomp_policy/android.software.media.c2-default-riscv64.policy",
|
||||
},
|
||||
x86: {
|
||||
src: "seccomp_policy/android.software.media.c2-default-x86.policy",
|
||||
},
|
||||
x86_64: {
|
||||
src: "seccomp_policy/android.software.media.c2-default-x86_64.policy",
|
||||
},
|
||||
},
|
||||
|
||||
// This may be removed.
|
||||
required: ["crash_dump.policy"],
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
service samsung-software-media-c2-hal /vendor/bin/hw/android.software.media.c2-service.samsung
|
||||
class hal
|
||||
user mediacodec
|
||||
group camera mediadrm drmrpc
|
||||
ioprio rt 4
|
||||
task_profiles ProcessCapacityHigh
|
||||
@@ -1,18 +0,0 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<!-- HIDL fragment -->
|
||||
<hal>
|
||||
<name>android.hardware.media.c2</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.2</version>
|
||||
<interface>
|
||||
<name>IComponentStore</name>
|
||||
<instance>default0</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<!-- AIDL fragment -->
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.media.c2</name>
|
||||
<version>1</version>
|
||||
<fqname>IComponentStore/default1</fqname>
|
||||
</hal>
|
||||
</manifest>
|
||||
@@ -1,11 +0,0 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="hidl" override="true">
|
||||
<name>android.hardware.media.c2</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IComponentStore</name>
|
||||
<instance>default0</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
||||
@@ -1,86 +0,0 @@
|
||||
# Copyright (C) 2019 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
futex: 1
|
||||
# ioctl calls are filtered via the selinux policy.
|
||||
ioctl: 1
|
||||
sched_yield: 1
|
||||
close: 1
|
||||
dup: 1
|
||||
ppoll: 1
|
||||
mprotect: arg2 in ~PROT_EXEC || arg2 in ~PROT_WRITE
|
||||
mmap2: arg2 in ~PROT_EXEC || arg2 in ~PROT_WRITE
|
||||
memfd_create: 1
|
||||
ftruncate: 1
|
||||
ftruncate64: 1
|
||||
|
||||
# mremap: Ensure |flags| are (MREMAP_MAYMOVE | MREMAP_FIXED) TODO: Once minijail
|
||||
# parser support for '<' is in this needs to be modified to also prevent
|
||||
# |old_address| and |new_address| from touching the exception vector page, which
|
||||
# on ARM is statically loaded at 0xffff 0000. See
|
||||
# http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211h/Babfeega.html
|
||||
# for more details.
|
||||
mremap: arg3 == 3
|
||||
munmap: 1
|
||||
prctl: 1
|
||||
getuid32: 1
|
||||
writev: 1
|
||||
sigaltstack: 1
|
||||
clone: 1
|
||||
exit: 1
|
||||
lseek: 1
|
||||
rt_sigprocmask: 1
|
||||
openat: 1
|
||||
open: 1
|
||||
fstat64: 1
|
||||
write: 1
|
||||
nanosleep: 1
|
||||
setpriority: 1
|
||||
set_tid_address: 1
|
||||
getdents64: 1
|
||||
readlinkat: 1
|
||||
readlink: 1
|
||||
read: 1
|
||||
pread64: 1
|
||||
fstatfs64: 1
|
||||
gettimeofday: 1
|
||||
faccessat: 1
|
||||
_llseek: 1
|
||||
fstatat64: 1
|
||||
ugetrlimit: 1
|
||||
exit_group: 1
|
||||
restart_syscall: 1
|
||||
rt_sigreturn: 1
|
||||
getrandom: 1
|
||||
madvise: 1
|
||||
|
||||
# crash dump policy additions
|
||||
sigreturn: 1
|
||||
clock_gettime: 1
|
||||
futex: 1
|
||||
getpid: 1
|
||||
gettid: 1
|
||||
pipe2: 1
|
||||
recvmsg: 1
|
||||
process_vm_readv: 1
|
||||
tgkill: 1
|
||||
rt_sigaction: 1
|
||||
rt_tgsigqueueinfo: 1
|
||||
#prctl: arg0 == PR_GET_NO_NEW_PRIVS || arg0 == 0x53564d41
|
||||
#mprotect: arg2 in 0x1|0x2
|
||||
#mmap2: arg2 in 0x1|0x2
|
||||
geteuid32: 1
|
||||
getgid32: 1
|
||||
getegid32: 1
|
||||
getgroups32: 1
|
||||
@@ -1,80 +0,0 @@
|
||||
# Copyright (C) 2021 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
futex: 1
|
||||
# ioctl calls are filtered via the selinux policy.
|
||||
ioctl: 1
|
||||
sched_yield: 1
|
||||
close: 1
|
||||
dup: 1
|
||||
ppoll: 1
|
||||
mprotect: arg2 in ~PROT_EXEC || arg2 in ~PROT_WRITE
|
||||
mmap: arg2 in ~PROT_EXEC || arg2 in ~PROT_WRITE
|
||||
getuid: 1
|
||||
getrlimit: 1
|
||||
fstat: 1
|
||||
newfstatat: 1
|
||||
fstatfs: 1
|
||||
memfd_create: 1
|
||||
ftruncate: 1
|
||||
|
||||
# mremap: Ensure |flags| are (MREMAP_MAYMOVE | MREMAP_FIXED) TODO: Once minijail
|
||||
# parser support for '<' is in this needs to be modified to also prevent
|
||||
# |old_address| and |new_address| from touching the exception vector page, which
|
||||
# on ARM is statically loaded at 0xffff 0000. See
|
||||
# http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211h/Babfeega.html
|
||||
# for more details.
|
||||
mremap: arg3 == 3 || arg3 == MREMAP_MAYMOVE
|
||||
munmap: 1
|
||||
prctl: 1
|
||||
writev: 1
|
||||
sigaltstack: 1
|
||||
clone: 1
|
||||
exit: 1
|
||||
lseek: 1
|
||||
rt_sigprocmask: 1
|
||||
openat: 1
|
||||
write: 1
|
||||
nanosleep: 1
|
||||
setpriority: 1
|
||||
set_tid_address: 1
|
||||
getdents64: 1
|
||||
readlinkat: 1
|
||||
read: 1
|
||||
pread64: 1
|
||||
gettimeofday: 1
|
||||
faccessat: 1
|
||||
exit_group: 1
|
||||
restart_syscall: 1
|
||||
rt_sigreturn: 1
|
||||
getrandom: 1
|
||||
madvise: 1
|
||||
|
||||
# crash dump policy additions
|
||||
clock_gettime: 1
|
||||
getpid: 1
|
||||
gettid: 1
|
||||
pipe2: 1
|
||||
recvmsg: 1
|
||||
process_vm_readv: 1
|
||||
tgkill: 1
|
||||
rt_sigaction: 1
|
||||
rt_tgsigqueueinfo: 1
|
||||
#mprotect: arg2 in 0x1|0x2
|
||||
munmap: 1
|
||||
#mmap: arg2 in 0x1|0x2
|
||||
geteuid: 1
|
||||
getgid: 1
|
||||
getegid: 1
|
||||
getgroups: 1
|
||||
@@ -1,74 +0,0 @@
|
||||
# Copyright (C) 2019 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
futex: 1
|
||||
# ioctl calls are filtered via the selinux policy.
|
||||
ioctl: 1
|
||||
sched_yield: 1
|
||||
close: 1
|
||||
dup: 1
|
||||
ppoll: 1
|
||||
mprotect: arg2 in ~PROT_EXEC || arg2 in ~PROT_WRITE
|
||||
mmap: arg2 in ~PROT_EXEC || arg2 in ~PROT_WRITE
|
||||
getuid: 1
|
||||
getrlimit: 1
|
||||
fstat: 1
|
||||
newfstatat: 1
|
||||
fstatfs: 1
|
||||
memfd_create: 1
|
||||
ftruncate: 1
|
||||
|
||||
mremap: arg3 == 3 || arg3 == MREMAP_MAYMOVE
|
||||
munmap: 1
|
||||
prctl: 1
|
||||
writev: 1
|
||||
sigaltstack: 1
|
||||
clone: 1
|
||||
exit: 1
|
||||
lseek: 1
|
||||
rt_sigprocmask: 1
|
||||
openat: 1
|
||||
write: 1
|
||||
nanosleep: 1
|
||||
setpriority: 1
|
||||
set_tid_address: 1
|
||||
getdents64: 1
|
||||
readlinkat: 1
|
||||
read: 1
|
||||
pread64: 1
|
||||
gettimeofday: 1
|
||||
faccessat: 1
|
||||
exit_group: 1
|
||||
restart_syscall: 1
|
||||
rt_sigreturn: 1
|
||||
getrandom: 1
|
||||
madvise: 1
|
||||
|
||||
# crash dump policy additions
|
||||
clock_gettime: 1
|
||||
getpid: 1
|
||||
gettid: 1
|
||||
pipe2: 1
|
||||
recvmsg: 1
|
||||
process_vm_readv: 1
|
||||
tgkill: 1
|
||||
rt_sigaction: 1
|
||||
rt_tgsigqueueinfo: 1
|
||||
#mprotect: arg2 in 0x1|0x2
|
||||
munmap: 1
|
||||
#mmap: arg2 in 0x1|0x2
|
||||
geteuid: 1
|
||||
getgid: 1
|
||||
getegid: 1
|
||||
getgroups: 1
|
||||
@@ -1,71 +0,0 @@
|
||||
# Copyright (C) 2021 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
read: 1
|
||||
mprotect: 1
|
||||
prctl: 1
|
||||
openat: 1
|
||||
open: 1
|
||||
getuid32: 1
|
||||
getuid: 1
|
||||
getrlimit: 1
|
||||
writev: 1
|
||||
ioctl: 1
|
||||
close: 1
|
||||
mmap2: 1
|
||||
mmap: 1
|
||||
fstat64: 1
|
||||
fstat: 1
|
||||
stat64: 1
|
||||
statfs64: 1
|
||||
madvise: 1
|
||||
fstatat64: 1
|
||||
newfstatat: 1
|
||||
futex: 1
|
||||
munmap: 1
|
||||
faccessat: 1
|
||||
_llseek: 1
|
||||
lseek: 1
|
||||
clone: 1
|
||||
sigaltstack: 1
|
||||
setpriority: 1
|
||||
restart_syscall: 1
|
||||
exit: 1
|
||||
exit_group: 1
|
||||
rt_sigreturn: 1
|
||||
ugetrlimit: 1
|
||||
readlink: 1
|
||||
readlinkat: 1
|
||||
_llseek: 1
|
||||
fstatfs64: 1
|
||||
fstatfs: 1
|
||||
pread64: 1
|
||||
mremap: 1
|
||||
dup: 1
|
||||
set_tid_address: 1
|
||||
write: 1
|
||||
nanosleep: 1
|
||||
sched_setscheduler: 1
|
||||
uname: 1
|
||||
memfd_create: 1
|
||||
ftruncate: 1
|
||||
ftruncate64: 1
|
||||
|
||||
# Required by AddressSanitizer
|
||||
gettid: 1
|
||||
sched_yield: 1
|
||||
getpid: 1
|
||||
gettid: 1
|
||||
|
||||
@include /system/etc/seccomp_policy/crash_dump.x86.policy
|
||||
@@ -1,71 +0,0 @@
|
||||
# Copyright (C) 2021 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
read: 1
|
||||
mprotect: 1
|
||||
prctl: 1
|
||||
openat: 1
|
||||
open: 1
|
||||
getuid32: 1
|
||||
getuid: 1
|
||||
getrlimit: 1
|
||||
writev: 1
|
||||
ioctl: 1
|
||||
close: 1
|
||||
mmap2: 1
|
||||
mmap: 1
|
||||
fstat64: 1
|
||||
fstat: 1
|
||||
stat64: 1
|
||||
statfs64: 1
|
||||
madvise: 1
|
||||
fstatat64: 1
|
||||
newfstatat: 1
|
||||
futex: 1
|
||||
munmap: 1
|
||||
faccessat: 1
|
||||
_llseek: 1
|
||||
lseek: 1
|
||||
clone: 1
|
||||
sigaltstack: 1
|
||||
setpriority: 1
|
||||
restart_syscall: 1
|
||||
exit: 1
|
||||
exit_group: 1
|
||||
rt_sigreturn: 1
|
||||
ugetrlimit: 1
|
||||
readlink: 1
|
||||
readlinkat: 1
|
||||
_llseek: 1
|
||||
fstatfs64: 1
|
||||
fstatfs: 1
|
||||
pread64: 1
|
||||
mremap: 1
|
||||
dup: 1
|
||||
set_tid_address: 1
|
||||
write: 1
|
||||
nanosleep: 1
|
||||
sched_setscheduler: 1
|
||||
uname: 1
|
||||
memfd_create: 1
|
||||
ftruncate: 1
|
||||
ftruncate64: 1
|
||||
|
||||
# Required by AddressSanitizer
|
||||
gettid: 1
|
||||
sched_yield: 1
|
||||
getpid: 1
|
||||
gettid: 1
|
||||
|
||||
@include /system/etc/seccomp_policy/crash_dump.x86.policy
|
||||
@@ -1,100 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018 The Android Open Source Project
|
||||
* Copyright 2025 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// #define LOG_NDEBUG 0
|
||||
#define LOG_TAG "android.software.media.c2-service.samsung"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <minijail.h>
|
||||
|
||||
// HIDL
|
||||
#ifdef LEGACY_COMPONENT_STORE
|
||||
#include <binder/ProcessState.h>
|
||||
#include <hidl/HidlTransportSupport.h>
|
||||
#endif
|
||||
|
||||
// AIDL
|
||||
#include <codec2/aidl/ComponentStore.h>
|
||||
|
||||
// This is the absolute on-device path of the prebuild_etc module
|
||||
// "android.software.media.c2-default-seccomp_policy" in Android.bp.
|
||||
static constexpr char kBaseSeccompPolicyPath[] =
|
||||
"/vendor/etc/seccomp_policy/"
|
||||
"android.software.media.c2-default-seccomp_policy";
|
||||
|
||||
// Additional seccomp permissions can be added in this file.
|
||||
// This file does not exist by default.
|
||||
static constexpr char kExtSeccompPolicyPath[] =
|
||||
"/vendor/etc/seccomp_policy/"
|
||||
"android.software.media.c2-extended-seccomp_policy";
|
||||
|
||||
// We want multiple threads to be running so that a blocking operation
|
||||
// on one codec does not block the other codecs.
|
||||
// For HIDL: Extra threads may be needed to handle a stacked IPC sequence that
|
||||
// contains alternating binder and hwbinder calls. (See b/35283480.)
|
||||
static constexpr int kThreadCount = 8;
|
||||
|
||||
#ifndef LEGACY_COMPONENT_STORE
|
||||
extern "C" void RegisterSECCodecAidlServices();
|
||||
extern "C" void RegisterSECCodecHidlServices();
|
||||
#else
|
||||
extern "C" void RegisterSECCodecServices();
|
||||
#endif
|
||||
|
||||
void runAidlService() {
|
||||
#ifndef LEGACY_COMPONENT_STORE
|
||||
RegisterSECCodecAidlServices();
|
||||
#endif
|
||||
}
|
||||
|
||||
void runHidlService() {
|
||||
#ifdef LEGACY_COMPONENT_STORE
|
||||
using namespace ::android;
|
||||
|
||||
// Enable vndbinder to allow vendor-to-vendor binder calls.
|
||||
ProcessState::initWithDriver("/dev/vndbinder");
|
||||
|
||||
ProcessState::self()->startThreadPool();
|
||||
hardware::configureRpcThreadpool(kThreadCount, true /* callerWillJoin */);
|
||||
|
||||
RegisterSECCodecServices();
|
||||
|
||||
hardware::joinRpcThreadpool();
|
||||
#else
|
||||
RegisterSECCodecHidlServices();
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int /* argc */, char** /* argv */) {
|
||||
const bool aidlEnabled = ::aidl::android::hardware::media::c2::utils::IsSelected();
|
||||
#ifdef LEGACY_COMPONENT_STORE
|
||||
LOG(DEBUG) << "android.software.media.c2@1.0-service.samsung starting...";
|
||||
#else
|
||||
LOG(DEBUG) << "android.software.media.c2" << (aidlEnabled ? "-V1" : "@1.2")
|
||||
<< "-service.samsung starting...";
|
||||
#endif
|
||||
|
||||
// Set up minijail to limit system calls.
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
android::SetUpMinijail(kBaseSeccompPolicyPath, kExtSeccompPolicyPath);
|
||||
if (aidlEnabled) {
|
||||
runAidlService();
|
||||
} else {
|
||||
runHidlService();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -12,14 +12,16 @@ namespace hardware {
|
||||
namespace biometrics {
|
||||
namespace fingerprint {
|
||||
|
||||
CancellationSignal::CancellationSignal(Session* session) : mSession(session) {}
|
||||
CancellationSignal::CancellationSignal(Session* session)
|
||||
: mSession(session) {
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus CancellationSignal::cancel() {
|
||||
return mSession->cancel();
|
||||
}
|
||||
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
|
||||
@@ -19,16 +19,16 @@ namespace biometrics {
|
||||
namespace fingerprint {
|
||||
|
||||
class CancellationSignal : public BnCancellationSignal {
|
||||
public:
|
||||
public:
|
||||
CancellationSignal(Session* session);
|
||||
ndk::ScopedAStatus cancel() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
Session* mSession;
|
||||
};
|
||||
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
|
||||
@@ -37,12 +37,12 @@ constexpr char FW_VERSION[] = "1.01";
|
||||
constexpr char SERIAL_NUMBER[] = "00000001";
|
||||
constexpr char SW_COMPONENT_ID[] = "matchingAlgorithm";
|
||||
constexpr char SW_VERSION[] = "vendor/version/revision";
|
||||
} // namespace
|
||||
}
|
||||
|
||||
static Fingerprint* sInstance;
|
||||
|
||||
Fingerprint::Fingerprint() {
|
||||
sInstance = this; // keep track of the most recent instance
|
||||
sInstance = this; // keep track of the most recent instance
|
||||
if (!mHal.openHal(Fingerprint::notify)) {
|
||||
LOG(ERROR) << "Can't open HAL module";
|
||||
}
|
||||
@@ -75,8 +75,9 @@ Fingerprint::Fingerprint() {
|
||||
goto skip_uinput_setup;
|
||||
}
|
||||
|
||||
int err = ioctl(uinputFd, UI_SET_EVBIT, EV_KEY) | ioctl(uinputFd, UI_SET_KEYBIT, KEY_UP) |
|
||||
ioctl(uinputFd, UI_SET_KEYBIT, KEY_DOWN);
|
||||
int err = ioctl(uinputFd, UI_SET_EVBIT, EV_KEY) |
|
||||
ioctl(uinputFd, UI_SET_KEYBIT, KEY_UP) |
|
||||
ioctl(uinputFd, UI_SET_KEYBIT, KEY_DOWN);
|
||||
if (err != 0) {
|
||||
LOG(ERROR) << "Unable to enable key events";
|
||||
goto skip_uinput_setup;
|
||||
@@ -108,38 +109,34 @@ ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector<SensorProps>* out) {
|
||||
std::vector<common::ComponentInfo> componentInfo = {
|
||||
{HW_COMPONENT_ID, HW_VERSION, FW_VERSION, SERIAL_NUMBER, "" /* softwareVersion */},
|
||||
{SW_COMPONENT_ID, "" /* hardwareVersion */, "" /* firmwareVersion */,
|
||||
"" /* serialNumber */, SW_VERSION}};
|
||||
common::CommonProps commonProps = {SENSOR_ID, SENSOR_STRENGTH, mMaxEnrollmentsPerUser,
|
||||
componentInfo};
|
||||
"" /* serialNumber */, SW_VERSION}};
|
||||
common::CommonProps commonProps = {SENSOR_ID, SENSOR_STRENGTH,
|
||||
mMaxEnrollmentsPerUser, componentInfo};
|
||||
|
||||
std::vector<SensorLocation> sensorLocations;
|
||||
SensorLocation sensorLocation;
|
||||
std::string loc = FingerprintHalProperties::sensor_location().value_or("");
|
||||
std::vector<std::string> sensors = Split(loc, ";");
|
||||
std::vector<std::string> dim = Split(loc, "|");
|
||||
if (dim.size() >= 3 && dim.size() <= 4) {
|
||||
ParseInt(dim[0], &sensorLocation.sensorLocationX);
|
||||
ParseInt(dim[1], &sensorLocation.sensorLocationY);
|
||||
ParseInt(dim[2], &sensorLocation.sensorRadius);
|
||||
|
||||
for (const auto& sensor : sensors) {
|
||||
std::vector<std::string> dim = Split(sensor, "|");
|
||||
if (dim.size() >= 3 && dim.size() <= 4) {
|
||||
SensorLocation sensorLocation;
|
||||
ParseInt(dim[0], &sensorLocation.sensorLocationX);
|
||||
ParseInt(dim[1], &sensorLocation.sensorLocationY);
|
||||
ParseInt(dim[2], &sensorLocation.sensorRadius);
|
||||
|
||||
if (dim.size() == 4) {
|
||||
sensorLocation.display = dim[3];
|
||||
}
|
||||
|
||||
sensorLocations.push_back(sensorLocation);
|
||||
} else if (!sensor.empty()) {
|
||||
LOG(WARNING) << "Invalid sensor location input (x|y|radius|display): " << sensor;
|
||||
}
|
||||
if (dim.size() >= 4)
|
||||
sensorLocation.display = dim[3];
|
||||
} else if(loc.length() > 0) {
|
||||
LOG(WARNING) << "Invalid sensor location input (x|y|radius|display): " << loc;
|
||||
}
|
||||
|
||||
LOG(INFO) << "Sensor type: " << ::android::internal::ToString(mSensorType) << " locations:";
|
||||
for (const auto& sensorLocation : sensorLocations) {
|
||||
LOG(INFO) << sensorLocation.toString();
|
||||
}
|
||||
LOG(INFO) << "Sensor type: " << ::android::internal::ToString(mSensorType)
|
||||
<< " location: " << sensorLocation.toString();
|
||||
|
||||
*out = {{commonProps, mSensorType, sensorLocations, mSupportsGestures, false, false, false,
|
||||
*out = {{commonProps,
|
||||
mSensorType,
|
||||
{sensorLocation},
|
||||
mSupportsGestures,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
std::nullopt}};
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
@@ -160,8 +157,8 @@ ndk::ScopedAStatus Fingerprint::createSession(int32_t /*sensorId*/, int32_t user
|
||||
|
||||
void Fingerprint::notify(const fingerprint_msg_t* msg) {
|
||||
Fingerprint* thisPtr = sInstance;
|
||||
if (msg->type == FINGERPRINT_ACQUIRED &&
|
||||
msg->data.acquired.acquired_info > SEM_FINGERPRINT_EVENT_BASE) {
|
||||
if (msg->type == FINGERPRINT_ACQUIRED
|
||||
&& msg->data.acquired.acquired_info > SEM_FINGERPRINT_EVENT_BASE) {
|
||||
thisPtr->handleEvent(msg->data.acquired.acquired_info);
|
||||
return;
|
||||
}
|
||||
@@ -180,8 +177,9 @@ void Fingerprint::handleEvent(int eventCode) {
|
||||
case SEM_FINGERPRINT_EVENT_GESTURE_SWIPE_UP: {
|
||||
if (!mSupportsGestures) return;
|
||||
|
||||
struct input_event event{};
|
||||
int keycode = eventCode == SEM_FINGERPRINT_EVENT_GESTURE_SWIPE_UP ? KEY_UP : KEY_DOWN;
|
||||
struct input_event event {};
|
||||
int keycode = eventCode == SEM_FINGERPRINT_EVENT_GESTURE_SWIPE_UP ?
|
||||
KEY_UP : KEY_DOWN;
|
||||
|
||||
// Report the key
|
||||
event.type = EV_KEY;
|
||||
@@ -227,8 +225,8 @@ void Fingerprint::handleEvent(int eventCode) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
|
||||
@@ -23,16 +23,16 @@ namespace biometrics {
|
||||
namespace fingerprint {
|
||||
|
||||
class Fingerprint : public BnFingerprint {
|
||||
public:
|
||||
public:
|
||||
Fingerprint();
|
||||
ndk::ScopedAStatus getSensorProps(std::vector<SensorProps>* _aidl_return) override;
|
||||
ndk::ScopedAStatus createSession(int32_t sensorId, int32_t userId,
|
||||
const std::shared_ptr<ISessionCallback>& cb,
|
||||
std::shared_ptr<ISession>* out) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
static void notify(
|
||||
const fingerprint_msg_t* msg); /* Static callback for legacy HAL implementation */
|
||||
const fingerprint_msg_t* msg); /* Static callback for legacy HAL implementation */
|
||||
void handleEvent(int eventCode);
|
||||
|
||||
LegacyHAL mHal;
|
||||
@@ -45,8 +45,8 @@ class Fingerprint : public BnFingerprint {
|
||||
std::shared_ptr<Session> mSession;
|
||||
};
|
||||
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
|
||||
@@ -36,13 +36,15 @@ inline void translate(const hw_auth_token_t& hat, HardwareAuthToken& authToken)
|
||||
authToken.authenticatorId = hat.authenticator_id;
|
||||
// these are in network order: translate to host
|
||||
authToken.authenticatorType =
|
||||
static_cast<keymaster::HardwareAuthenticatorType>(be32toh(hat.authenticator_type));
|
||||
static_cast<keymaster::HardwareAuthenticatorType>(
|
||||
be32toh(hat.authenticator_type));
|
||||
authToken.timestamp.milliSeconds = be64toh(hat.timestamp);
|
||||
authToken.mac.insert(authToken.mac.begin(), std::begin(hat.hmac), std::end(hat.hmac));
|
||||
authToken.mac.insert(authToken.mac.begin(), std::begin(hat.hmac),
|
||||
std::end(hat.hmac));
|
||||
}
|
||||
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
|
||||
@@ -19,40 +19,39 @@ namespace fingerprint {
|
||||
bool LegacyHAL::openHal(fingerprint_notify_t notify) {
|
||||
void* handle = dlopen("libbauthserver.so", RTLD_NOW);
|
||||
|
||||
if (!handle) {
|
||||
if (!handle)
|
||||
handle = dlopen("libsfp_sensor.so", RTLD_NOW);
|
||||
}
|
||||
|
||||
if (handle) {
|
||||
int err;
|
||||
|
||||
ss_fingerprint_close = reinterpret_cast<typeof(ss_fingerprint_close)>(
|
||||
dlsym(handle, "ss_fingerprint_close"));
|
||||
ss_fingerprint_close =
|
||||
reinterpret_cast<typeof(ss_fingerprint_close)>(dlsym(handle, "ss_fingerprint_close"));
|
||||
ss_fingerprint_open =
|
||||
reinterpret_cast<typeof(ss_fingerprint_open)>(dlsym(handle, "ss_fingerprint_open"));
|
||||
reinterpret_cast<typeof(ss_fingerprint_open)>(dlsym(handle, "ss_fingerprint_open"));
|
||||
|
||||
ss_set_notify_callback = reinterpret_cast<typeof(ss_set_notify_callback)>(
|
||||
dlsym(handle, "ss_set_notify_callback"));
|
||||
dlsym(handle, "ss_set_notify_callback"));
|
||||
ss_fingerprint_pre_enroll = reinterpret_cast<typeof(ss_fingerprint_pre_enroll)>(
|
||||
dlsym(handle, "ss_fingerprint_pre_enroll"));
|
||||
ss_fingerprint_enroll = reinterpret_cast<typeof(ss_fingerprint_enroll)>(
|
||||
dlsym(handle, "ss_fingerprint_enroll"));
|
||||
dlsym(handle, "ss_fingerprint_pre_enroll"));
|
||||
ss_fingerprint_enroll =
|
||||
reinterpret_cast<typeof(ss_fingerprint_enroll)>(dlsym(handle, "ss_fingerprint_enroll"));
|
||||
ss_fingerprint_post_enroll = reinterpret_cast<typeof(ss_fingerprint_post_enroll)>(
|
||||
dlsym(handle, "ss_fingerprint_post_enroll"));
|
||||
dlsym(handle, "ss_fingerprint_post_enroll"));
|
||||
ss_fingerprint_get_auth_id = reinterpret_cast<typeof(ss_fingerprint_get_auth_id)>(
|
||||
dlsym(handle, "ss_fingerprint_get_auth_id"));
|
||||
ss_fingerprint_cancel = reinterpret_cast<typeof(ss_fingerprint_cancel)>(
|
||||
dlsym(handle, "ss_fingerprint_cancel"));
|
||||
dlsym(handle, "ss_fingerprint_get_auth_id"));
|
||||
ss_fingerprint_cancel =
|
||||
reinterpret_cast<typeof(ss_fingerprint_cancel)>(dlsym(handle, "ss_fingerprint_cancel"));
|
||||
ss_fingerprint_enumerate = reinterpret_cast<typeof(ss_fingerprint_enumerate)>(
|
||||
dlsym(handle, "ss_fingerprint_enumerate"));
|
||||
ss_fingerprint_remove = reinterpret_cast<typeof(ss_fingerprint_remove)>(
|
||||
dlsym(handle, "ss_fingerprint_remove"));
|
||||
dlsym(handle, "ss_fingerprint_enumerate"));
|
||||
ss_fingerprint_remove =
|
||||
reinterpret_cast<typeof(ss_fingerprint_remove)>(dlsym(handle, "ss_fingerprint_remove"));
|
||||
ss_fingerprint_set_active_group = reinterpret_cast<typeof(ss_fingerprint_set_active_group)>(
|
||||
dlsym(handle, "ss_fingerprint_set_active_group"));
|
||||
dlsym(handle, "ss_fingerprint_set_active_group"));
|
||||
ss_fingerprint_authenticate = reinterpret_cast<typeof(ss_fingerprint_authenticate)>(
|
||||
dlsym(handle, "ss_fingerprint_authenticate"));
|
||||
dlsym(handle, "ss_fingerprint_authenticate"));
|
||||
ss_fingerprint_request = reinterpret_cast<typeof(ss_fingerprint_request)>(
|
||||
dlsym(handle, "ss_fingerprint_request"));
|
||||
dlsym(handle, "ss_fingerprint_request"));
|
||||
|
||||
if ((err = ss_fingerprint_open(nullptr)) != 0) {
|
||||
LOG(ERROR) << "Can't open fingerprint, error: " << err;
|
||||
@@ -77,8 +76,8 @@ int LegacyHAL::request(int cmd, int param) {
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace biometrics {
|
||||
namespace fingerprint {
|
||||
|
||||
class LegacyHAL {
|
||||
public:
|
||||
public:
|
||||
bool openHal(fingerprint_notify_t notify);
|
||||
int request(int cmd, int param);
|
||||
|
||||
@@ -32,12 +32,11 @@ class LegacyHAL {
|
||||
int (*ss_fingerprint_remove)(uint32_t gid, uint32_t fid);
|
||||
int (*ss_fingerprint_set_active_group)(uint32_t gid, const char* store_path);
|
||||
int (*ss_fingerprint_authenticate)(uint64_t operation_id, uint32_t gid);
|
||||
int (*ss_fingerprint_request)(uint32_t cmd, char* inBuf, uint32_t inBuf_length, char* outBuf,
|
||||
uint32_t outBuf_length, uint32_t param);
|
||||
int (*ss_fingerprint_request)(uint32_t cmd, char *inBuf, uint32_t inBuf_length, char *outBuf, uint32_t outBuf_length, uint32_t param);
|
||||
};
|
||||
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "LockoutTracker.h"
|
||||
#include "Fingerprint.h"
|
||||
#include "LockoutTracker.h"
|
||||
|
||||
#include <util/Util.h>
|
||||
|
||||
@@ -16,9 +16,8 @@ namespace biometrics {
|
||||
namespace fingerprint {
|
||||
|
||||
void LockoutTracker::reset(bool clearAttemptCounter) {
|
||||
if (clearAttemptCounter) {
|
||||
if (clearAttemptCounter)
|
||||
mFailedCount = 0;
|
||||
}
|
||||
mLockoutTimedStart = 0;
|
||||
mCurrentMode = LockoutMode::NONE;
|
||||
}
|
||||
@@ -26,9 +25,9 @@ void LockoutTracker::reset(bool clearAttemptCounter) {
|
||||
void LockoutTracker::addFailedAttempt() {
|
||||
mFailedCount++;
|
||||
|
||||
if (mFailedCount >= LOCKOUT_PERMANENT_THRESHOLD) {
|
||||
if (mFailedCount >= LOCKOUT_PERMANENT_THRESHOLD)
|
||||
mCurrentMode = LockoutMode::PERMANENT;
|
||||
} else if (mFailedCount >= LOCKOUT_TIMED_THRESHOLD) {
|
||||
else if (mFailedCount >= LOCKOUT_TIMED_THRESHOLD) {
|
||||
mCurrentMode = LockoutMode::TIMED;
|
||||
mLockoutTimedStart = Util::getSystemNanoTime();
|
||||
}
|
||||
@@ -57,8 +56,8 @@ int64_t LockoutTracker::getLockoutTimeLeft() {
|
||||
return res;
|
||||
}
|
||||
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2025 The LineageOS Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace aidl {
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
@@ -18,23 +16,27 @@ namespace fingerprint {
|
||||
#define LOCKOUT_TIMED_DURATION 30 * 1000
|
||||
#define LOCKOUT_PERMANENT_THRESHOLD 20
|
||||
|
||||
enum class LockoutMode { NONE, TIMED, PERMANENT };
|
||||
enum class LockoutMode {
|
||||
NONE,
|
||||
TIMED,
|
||||
PERMANENT
|
||||
};
|
||||
|
||||
class LockoutTracker {
|
||||
public:
|
||||
public:
|
||||
void reset(bool clearAttemptCounter);
|
||||
LockoutMode getMode();
|
||||
void addFailedAttempt();
|
||||
int64_t getLockoutTimeLeft();
|
||||
|
||||
private:
|
||||
private:
|
||||
int32_t mFailedCount = 0;
|
||||
int64_t mLockoutTimedStart;
|
||||
LockoutMode mCurrentMode;
|
||||
};
|
||||
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "Session.h"
|
||||
#include "CancellationSignal.h"
|
||||
#include "Legacy2Aidl.h"
|
||||
#include "Session.h"
|
||||
#include "VendorConstants.h"
|
||||
|
||||
#include <fingerprint.sysprop.h>
|
||||
@@ -36,7 +36,10 @@ void onClientDeath(void* cookie) {
|
||||
|
||||
Session::Session(LegacyHAL hal, int userId, std::shared_ptr<ISessionCallback> cb,
|
||||
LockoutTracker lockoutTracker)
|
||||
: mHal(hal), mLockoutTracker(lockoutTracker), mUserId(userId), mCb(cb) {
|
||||
: mHal(hal),
|
||||
mLockoutTracker(lockoutTracker),
|
||||
mUserId(userId),
|
||||
mCb(cb) {
|
||||
mDeathRecipient = AIBinder_DeathRecipient_new(onClientDeath);
|
||||
|
||||
char filename[64];
|
||||
@@ -119,9 +122,8 @@ ndk::ScopedAStatus Session::enumerateEnrollments() {
|
||||
|
||||
if (mHal.ss_fingerprint_enumerate) {
|
||||
int32_t error = mHal.ss_fingerprint_enumerate();
|
||||
if (error) {
|
||||
if (error)
|
||||
LOG(ERROR) << "ss_fingerprint_enumerate failed: " << error;
|
||||
}
|
||||
} else {
|
||||
std::vector<int> enrollments;
|
||||
char filename[64];
|
||||
@@ -133,9 +135,8 @@ ndk::ScopedAStatus Session::enumerateEnrollments() {
|
||||
while ((entry = readdir(directory))) {
|
||||
int uid, fid;
|
||||
if (sscanf(entry->d_name, "User_%d_%dtmpl.dat", &uid, &fid)) {
|
||||
if (uid == mUserId) {
|
||||
if (uid == mUserId)
|
||||
enrollments.push_back(fid);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(directory);
|
||||
@@ -154,9 +155,8 @@ ndk::ScopedAStatus Session::removeEnrollments(const std::vector<int32_t>& enroll
|
||||
|
||||
for (int32_t enrollment : enrollmentIds) {
|
||||
int32_t error = mHal.ss_fingerprint_remove(mUserId, enrollment);
|
||||
if (error) {
|
||||
if (error)
|
||||
LOG(ERROR) << "ss_fingerprint_remove failed: " << error;
|
||||
}
|
||||
}
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
@@ -195,8 +195,8 @@ ndk::ScopedAStatus Session::close() {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus Session::onPointerDown(int32_t /*pointerId*/, int32_t /*x*/, int32_t /*y*/,
|
||||
float /*minor*/, float /*major*/) {
|
||||
ndk::ScopedAStatus Session::onPointerDown(int32_t /*pointerId*/, int32_t /*x*/, int32_t /*y*/, float /*minor*/,
|
||||
float /*major*/) {
|
||||
LOG(INFO) << "onPointerDown";
|
||||
|
||||
if (FingerprintHalProperties::request_touch_event().value_or(false)) {
|
||||
@@ -225,9 +225,9 @@ ndk::ScopedAStatus Session::onUiReady() {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus Session::authenticateWithContext(int64_t operationId,
|
||||
const OperationContext& /*context*/,
|
||||
std::shared_ptr<ICancellationSignal>* out) {
|
||||
ndk::ScopedAStatus Session::authenticateWithContext(
|
||||
int64_t operationId, const OperationContext& /*context*/,
|
||||
std::shared_ptr<ICancellationSignal>* out) {
|
||||
return authenticate(operationId, out);
|
||||
}
|
||||
|
||||
@@ -237,8 +237,8 @@ ndk::ScopedAStatus Session::enrollWithContext(const HardwareAuthToken& hat,
|
||||
return enroll(hat, out);
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus Session::detectInteractionWithContext(
|
||||
const OperationContext& /*context*/, std::shared_ptr<ICancellationSignal>* out) {
|
||||
ndk::ScopedAStatus Session::detectInteractionWithContext(const OperationContext& /*context*/,
|
||||
std::shared_ptr<ICancellationSignal>* out) {
|
||||
return detectInteraction(out);
|
||||
}
|
||||
|
||||
@@ -368,7 +368,8 @@ void Session::clearLockout(bool clearAttemptCounter) {
|
||||
|
||||
void Session::startLockoutTimer(int64_t timeout) {
|
||||
mIsLockoutTimerAborted = false;
|
||||
std::function<void()> action = std::bind(&Session::lockoutTimerExpired, this);
|
||||
std::function<void()> action =
|
||||
std::bind(&Session::lockoutTimerExpired, this);
|
||||
std::thread([timeout, action]() {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(timeout));
|
||||
action();
|
||||
@@ -378,9 +379,8 @@ void Session::startLockoutTimer(int64_t timeout) {
|
||||
}
|
||||
|
||||
void Session::lockoutTimerExpired() {
|
||||
if (!mIsLockoutTimerAborted) {
|
||||
if (!mIsLockoutTimerAborted)
|
||||
clearLockout(false);
|
||||
}
|
||||
|
||||
mIsLockoutTimerStarted = false;
|
||||
mIsLockoutTimerAborted = false;
|
||||
@@ -397,19 +397,18 @@ void Session::notify(const fingerprint_msg_t* msg) {
|
||||
case FINGERPRINT_ACQUIRED: {
|
||||
int32_t vendorCode = 0;
|
||||
AcquiredInfo result =
|
||||
VendorAcquiredFilter(msg->data.acquired.acquired_info, &vendorCode);
|
||||
VendorAcquiredFilter(msg->data.acquired.acquired_info, &vendorCode);
|
||||
LOG(DEBUG) << "onAcquired(" << static_cast<int>(result) << ")";
|
||||
mCb->onAcquired(result, vendorCode);
|
||||
} break;
|
||||
case FINGERPRINT_TEMPLATE_ENROLLING:
|
||||
if (FingerprintHalProperties::uses_percentage_samples().value_or(false)) {
|
||||
const_cast<fingerprint_msg_t*>(msg)->data.enroll.samples_remaining =
|
||||
100 - msg->data.enroll.samples_remaining;
|
||||
100 - msg->data.enroll.samples_remaining;
|
||||
}
|
||||
if (FingerprintHalProperties::cancel_on_enroll_completion().value_or(false)) {
|
||||
if (msg->data.enroll.samples_remaining == 0) {
|
||||
if (msg->data.enroll.samples_remaining == 0)
|
||||
mHal.ss_fingerprint_cancel();
|
||||
}
|
||||
}
|
||||
LOG(DEBUG) << "onEnrollResult(fid=" << msg->data.enroll.finger.fid
|
||||
<< ", gid=" << msg->data.enroll.finger.gid
|
||||
@@ -459,8 +458,8 @@ void Session::onCaptureReady() {
|
||||
mCaptureReady = true;
|
||||
}
|
||||
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace fingerprint {
|
||||
void onClientDeath(void* cookie);
|
||||
|
||||
class Session : public BnSession {
|
||||
public:
|
||||
public:
|
||||
Session(LegacyHAL hal, int userId, std::shared_ptr<ISessionCallback> cb,
|
||||
LockoutTracker lockoutTracker);
|
||||
ndk::ScopedAStatus generateChallenge() override;
|
||||
@@ -39,7 +39,8 @@ class Session : public BnSession {
|
||||
std::shared_ptr<ICancellationSignal>* out) override;
|
||||
ndk::ScopedAStatus authenticate(int64_t operationId,
|
||||
std::shared_ptr<ICancellationSignal>* out) override;
|
||||
ndk::ScopedAStatus detectInteraction(std::shared_ptr<ICancellationSignal>* out) override;
|
||||
ndk::ScopedAStatus detectInteraction(
|
||||
std::shared_ptr<ICancellationSignal>* out) override;
|
||||
ndk::ScopedAStatus enumerateEnrollments() override;
|
||||
ndk::ScopedAStatus removeEnrollments(const std::vector<int32_t>& enrollmentIds) override;
|
||||
ndk::ScopedAStatus getAuthenticatorId() override;
|
||||
@@ -50,13 +51,15 @@ class Session : public BnSession {
|
||||
float major) override;
|
||||
ndk::ScopedAStatus onPointerUp(int32_t pointerId) override;
|
||||
ndk::ScopedAStatus onUiReady() override;
|
||||
ndk::ScopedAStatus authenticateWithContext(int64_t operationId, const OperationContext& context,
|
||||
std::shared_ptr<ICancellationSignal>* out) override;
|
||||
ndk::ScopedAStatus enrollWithContext(const HardwareAuthToken& hat,
|
||||
const OperationContext& context,
|
||||
std::shared_ptr<ICancellationSignal>* out) override;
|
||||
ndk::ScopedAStatus authenticateWithContext(
|
||||
int64_t operationId, const OperationContext& context,
|
||||
std::shared_ptr<ICancellationSignal>* out) override;
|
||||
ndk::ScopedAStatus enrollWithContext(
|
||||
const HardwareAuthToken& hat, const OperationContext& context,
|
||||
std::shared_ptr<ICancellationSignal>* out) override;
|
||||
ndk::ScopedAStatus detectInteractionWithContext(
|
||||
const OperationContext& context, std::shared_ptr<ICancellationSignal>* out) override;
|
||||
const OperationContext& context,
|
||||
std::shared_ptr<ICancellationSignal>* out) override;
|
||||
ndk::ScopedAStatus onPointerDownWithContext(const PointerContext& context) override;
|
||||
ndk::ScopedAStatus onPointerUpWithContext(const PointerContext& context) override;
|
||||
ndk::ScopedAStatus onContextChanged(const OperationContext& context) override;
|
||||
@@ -66,10 +69,11 @@ class Session : public BnSession {
|
||||
ndk::ScopedAStatus cancel();
|
||||
binder_status_t linkToDeath(AIBinder* binder);
|
||||
bool isClosed();
|
||||
void notify(const fingerprint_msg_t* msg);
|
||||
void notify(
|
||||
const fingerprint_msg_t* msg);
|
||||
void onCaptureReady();
|
||||
|
||||
private:
|
||||
private:
|
||||
LegacyHAL mHal;
|
||||
LockoutTracker mLockoutTracker;
|
||||
bool mClosed = false;
|
||||
@@ -98,8 +102,8 @@ class Session : public BnSession {
|
||||
AIBinder_DeathRecipient* mDeathRecipient;
|
||||
};
|
||||
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
service vendor.fingerprint-default /vendor/bin/hw/android.hardware.biometrics.fingerprint-service.samsung
|
||||
class late_start
|
||||
class hal
|
||||
user system
|
||||
group system input uhid
|
||||
shutdown critical
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
#include "Fingerprint.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <android/binder_process.h>
|
||||
#include <android-base/logging.h>
|
||||
|
||||
using ::aidl::android::hardware::biometrics::fingerprint::Fingerprint;
|
||||
|
||||
@@ -17,10 +17,9 @@ int main() {
|
||||
std::shared_ptr<Fingerprint> fingerprint = ndk::SharedRefBase::make<Fingerprint>();
|
||||
|
||||
const std::string instance = std::string() + Fingerprint::descriptor + "/default";
|
||||
binder_status_t status =
|
||||
AServiceManager_addService(fingerprint->asBinder().get(), instance.c_str());
|
||||
binder_status_t status = AServiceManager_addService(fingerprint->asBinder().get(), instance.c_str());
|
||||
CHECK(status == STATUS_OK);
|
||||
|
||||
ABinderProcess_joinThreadPool();
|
||||
return EXIT_FAILURE; // should not reach
|
||||
return EXIT_FAILURE; // should not reach
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ static constexpr std::string_view gChargerArg{"--charger"};
|
||||
#if !CHARGER_FORCE_NO_UI
|
||||
namespace aidl::android::hardware::health {
|
||||
class ChargerCallbackImpl : public ChargerCallback {
|
||||
public:
|
||||
public:
|
||||
using ChargerCallback::ChargerCallback;
|
||||
bool ChargerEnableSuspend() override { return true; }
|
||||
};
|
||||
} // namespace aidl::android::hardware::health
|
||||
} // namespace aidl::android::hardware::health
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
@@ -64,9 +64,7 @@ int main(int argc, char** argv) {
|
||||
// If charger shouldn't have UI for your device, simply drop the line below
|
||||
// for your service implementation. This corresponds to
|
||||
// ro.charger.no_ui=true
|
||||
return ChargerModeMain(
|
||||
binder,
|
||||
std::make_shared<aidl::android::hardware::health::ChargerCallbackImpl>(binder));
|
||||
return ChargerModeMain(binder, std::make_shared<aidl::android::hardware::health::ChargerCallbackImpl>(binder));
|
||||
#endif
|
||||
|
||||
LOG(INFO) << "Starting charger mode without UI.";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.health</name>
|
||||
<version>4</version>
|
||||
<version>1</version>
|
||||
<fqname>IHealth/default</fqname>
|
||||
</hal>
|
||||
</manifest>
|
||||
|
||||
@@ -41,12 +41,10 @@ Lights::Lights() {
|
||||
mLights.emplace(LightType::BACKLIGHT,
|
||||
std::bind(&Lights::handleBacklight, this, std::placeholders::_1));
|
||||
#ifdef BUTTON_BRIGHTNESS_NODE
|
||||
mLights.emplace(LightType::BUTTONS,
|
||||
std::bind(&Lights::handleButtons, this, std::placeholders::_1));
|
||||
mLights.emplace(LightType::BUTTONS, std::bind(&Lights::handleButtons, this, std::placeholders::_1));
|
||||
#endif /* BUTTON_BRIGHTNESS_NODE */
|
||||
#ifdef LED_BLINK_NODE
|
||||
mLights.emplace(LightType::BATTERY,
|
||||
std::bind(&Lights::handleBattery, this, std::placeholders::_1));
|
||||
mLights.emplace(LightType::BATTERY, std::bind(&Lights::handleBattery, this, std::placeholders::_1));
|
||||
mLights.emplace(LightType::NOTIFICATIONS,
|
||||
std::bind(&Lights::handleNotifications, this, std::placeholders::_1));
|
||||
mLights.emplace(LightType::ATTENTION,
|
||||
@@ -149,7 +147,7 @@ void Lights::setNotificationLED() {
|
||||
|
||||
state.color = calibrateColor(state.color & COLOR_MASK, adjusted_brightness);
|
||||
set(LED_BLINK_NODE, ::android::base::StringPrintf("0x%08x %d %d", state.color, state.flashOnMs,
|
||||
state.flashOffMs));
|
||||
state.flashOffMs));
|
||||
|
||||
#ifdef LED_BLN_NODE
|
||||
if (bln) {
|
||||
@@ -170,7 +168,7 @@ uint32_t Lights::calibrateColor(uint32_t color, int32_t brightness) {
|
||||
|
||||
#define AutoHwLight(light) {.id = (int32_t)light, .type = light, .ordinal = 0}
|
||||
|
||||
ndk::ScopedAStatus Lights::getLights(std::vector<HwLight>* _aidl_return) {
|
||||
ndk::ScopedAStatus Lights::getLights(std::vector<HwLight> *_aidl_return) {
|
||||
for (auto const& light : mLights) {
|
||||
_aidl_return->push_back(AutoHwLight(light.first));
|
||||
}
|
||||
@@ -181,12 +179,11 @@ ndk::ScopedAStatus Lights::getLights(std::vector<HwLight>* _aidl_return) {
|
||||
uint32_t Lights::rgbToBrightness(const HwLightState& state) {
|
||||
uint32_t color = state.color & COLOR_MASK;
|
||||
|
||||
return ((77 * ((color >> 16) & 0xff)) + (150 * ((color >> 8) & 0xff)) +
|
||||
(29 * (color & 0xff))) >>
|
||||
return ((77 * ((color >> 16) & 0xff)) + (150 * ((color >> 8) & 0xff)) + (29 * (color & 0xff))) >>
|
||||
8;
|
||||
}
|
||||
|
||||
} // namespace light
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
} // namespace light
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
|
||||
@@ -9,11 +9,10 @@
|
||||
#include <aidl/android/hardware/light/BnLights.h>
|
||||
#include <samsung_lights.h>
|
||||
|
||||
#include <functional>
|
||||
#include <unordered_map>
|
||||
|
||||
using ::aidl::android::hardware::light::HwLight;
|
||||
using ::aidl::android::hardware::light::HwLightState;
|
||||
using ::aidl::android::hardware::light::HwLight;
|
||||
|
||||
namespace aidl {
|
||||
namespace android {
|
||||
@@ -21,13 +20,13 @@ namespace hardware {
|
||||
namespace light {
|
||||
|
||||
class Lights : public BnLights {
|
||||
public:
|
||||
public:
|
||||
Lights();
|
||||
|
||||
ndk::ScopedAStatus setLightState(int32_t id, const HwLightState& state) override;
|
||||
ndk::ScopedAStatus getLights(std::vector<HwLight>* _aidl_return) override;
|
||||
ndk::ScopedAStatus getLights(std::vector<HwLight> *_aidl_return) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
void handleBacklight(const HwLightState& state);
|
||||
#ifdef BUTTON_BRIGHTNESS_NODE
|
||||
void handleButtons(const HwLightState& state);
|
||||
@@ -50,7 +49,7 @@ class Lights : public BnLights {
|
||||
std::unordered_map<LightType, std::function<void(const HwLightState&)>> mLights;
|
||||
};
|
||||
|
||||
} // namespace light
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
} // namespace light
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#define LED_BLN_NODE "/sys/class/misc/backlightnotification/notification_led"
|
||||
|
||||
// Uncomment to enable variable button brightness
|
||||
// #define VAR_BUTTON_BRIGHTNESS 1
|
||||
//#define VAR_BUTTON_BRIGHTNESS 1
|
||||
|
||||
/*
|
||||
* Brightness adjustment factors
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
#include "Lights.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <android/binder_process.h>
|
||||
#include <android-base/logging.h>
|
||||
|
||||
using ::aidl::android::hardware::light::Lights;
|
||||
|
||||
@@ -23,5 +23,5 @@ int main() {
|
||||
CHECK(status == STATUS_OK);
|
||||
|
||||
ABinderProcess_joinThreadPool();
|
||||
return EXIT_FAILURE; // should not reach
|
||||
return EXIT_FAILURE; // should not reach
|
||||
}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/strings.h>
|
||||
#include <livedisplay/samsung/AdaptiveBacklight.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
using android::base::ReadFileToString;
|
||||
using android::base::Trim;
|
||||
using android::base::WriteStringToFile;
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace livedisplay {
|
||||
namespace samsung {
|
||||
|
||||
static constexpr const char* kBacklightPath = "/sys/class/lcd/panel/power_reduce";
|
||||
|
||||
bool AdaptiveBacklight::isSupported() {
|
||||
std::fstream file(kBacklightPath, file.in | file.out);
|
||||
return file.good();
|
||||
}
|
||||
|
||||
// Methods from ::aidl::vendor::lineage::livedisplay::BnAdaptiveBacklight follow.
|
||||
ndk::ScopedAStatus AdaptiveBacklight::getEnabled(bool* _aidl_return) {
|
||||
std::string tmp;
|
||||
int32_t contents = 0;
|
||||
|
||||
if (!ReadFileToString(kBacklightPath, &tmp)) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
contents = std::stoi(Trim(tmp));
|
||||
|
||||
*_aidl_return = contents > 0;
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus AdaptiveBacklight::setEnabled(bool enabled) {
|
||||
if (!WriteStringToFile(enabled ? "1" : "0", kBacklightPath, true)) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
} // namespace samsung
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
@@ -1,65 +0,0 @@
|
||||
//
|
||||
// SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
filegroup {
|
||||
name: "vendor.lineage.livedisplay-samsung-exynos",
|
||||
srcs: [
|
||||
"AdaptiveBacklight.cpp",
|
||||
"DisplayColorCalibration.cpp",
|
||||
"DisplayModes.cpp",
|
||||
"ReadingEnhancementExynos.cpp",
|
||||
"SunlightEnhancementExynos.cpp",
|
||||
"serviceExynos.cpp",
|
||||
],
|
||||
}
|
||||
|
||||
filegroup {
|
||||
name: "vendor.lineage.livedisplay-samsung-qcom",
|
||||
srcs: [
|
||||
"AdaptiveBacklight.cpp",
|
||||
"DisplayColorCalibration.cpp",
|
||||
"DisplayModes.cpp",
|
||||
"SunlightEnhancement.cpp",
|
||||
"service.cpp",
|
||||
],
|
||||
}
|
||||
|
||||
cc_defaults {
|
||||
name: "livedisplay_samsung_defaults",
|
||||
defaults: ["hidl_defaults"],
|
||||
relative_install_path: "hw",
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"libbinder",
|
||||
"libutils",
|
||||
"vendor.lineage.livedisplay-V1-ndk",
|
||||
],
|
||||
header_libs: [
|
||||
"vendor.lineage.livedisplay-samsung-headers",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_headers {
|
||||
name: "vendor.lineage.livedisplay-samsung-headers",
|
||||
vendor_available: true,
|
||||
export_include_dirs: ["include"],
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
name: "vendor.lineage.livedisplay-service.samsung-exynos",
|
||||
defaults: ["livedisplay_samsung_defaults"],
|
||||
init_rc: ["vendor.lineage.livedisplay-service.samsung-exynos.rc"],
|
||||
srcs: [":vendor.lineage.livedisplay-samsung-exynos"],
|
||||
vendor: true,
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
name: "vendor.lineage.livedisplay-service.samsung-qcom",
|
||||
defaults: ["livedisplay_samsung_defaults"],
|
||||
init_rc: ["vendor.lineage.livedisplay-service.samsung-qcom.rc"],
|
||||
srcs: [":vendor.lineage.livedisplay-samsung-qcom"],
|
||||
vendor: true,
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/strings.h>
|
||||
#include <livedisplay/samsung/DisplayColorCalibration.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
using android::base::ReadFileToString;
|
||||
using android::base::Split;
|
||||
using android::base::Trim;
|
||||
using android::base::WriteStringToFile;
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace livedisplay {
|
||||
namespace samsung {
|
||||
|
||||
static constexpr const char* kRGBPath = "/sys/class/mdnie/mdnie/sensorRGB";
|
||||
|
||||
bool DisplayColorCalibration::isSupported() {
|
||||
std::fstream file(kRGBPath, file.in | file.out);
|
||||
return file.good();
|
||||
}
|
||||
|
||||
// Methods from ::aidl::vendor::lineage::livedisplay::BnDisplayColorCalibration follow.
|
||||
ndk::ScopedAStatus DisplayColorCalibration::getMaxValue(int32_t* _aidl_return) {
|
||||
*_aidl_return = 255;
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus DisplayColorCalibration::getMinValue(int32_t* _aidl_return) {
|
||||
*_aidl_return = 1;
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus DisplayColorCalibration::getCalibration(std::vector<int32_t>* _aidl_return) {
|
||||
std::vector<int32_t> rgb;
|
||||
std::string tmp;
|
||||
|
||||
if (ReadFileToString(kRGBPath, &tmp)) {
|
||||
std::vector<std::string> colors = Split(Trim(tmp), " ");
|
||||
for (const std::string& color : colors) {
|
||||
rgb.push_back(std::stoi(color));
|
||||
}
|
||||
} else {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
|
||||
*_aidl_return = rgb;
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus DisplayColorCalibration::setCalibration(const std::vector<int32_t>& rgb) {
|
||||
std::string contents;
|
||||
|
||||
for (const int32_t& color : rgb) {
|
||||
contents += std::to_string(color) + " ";
|
||||
}
|
||||
|
||||
if (!WriteStringToFile(Trim(contents), kRGBPath, true)) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
} // namespace samsung
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/strings.h>
|
||||
#include <livedisplay/samsung/ReadingEnhancementExynos.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
using android::base::ReadFileToString;
|
||||
using android::base::Trim;
|
||||
using android::base::WriteStringToFile;
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace livedisplay {
|
||||
namespace samsung {
|
||||
|
||||
static constexpr const char* kREPath = "/sys/class/mdnie/mdnie/accessibility";
|
||||
|
||||
bool ReadingEnhancementExynos::isSupported() {
|
||||
std::fstream file(kREPath, file.in | file.out);
|
||||
return file.good();
|
||||
}
|
||||
|
||||
// Methods from ::aidl::vendor::lineage::livedisplay::BnReadingEnhancement follow.
|
||||
ndk::ScopedAStatus ReadingEnhancementExynos::getEnabled(bool* _aidl_return) {
|
||||
std::string contents;
|
||||
|
||||
if (!ReadFileToString(kREPath, &contents)) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
contents = Trim(contents);
|
||||
|
||||
*_aidl_return =
|
||||
!contents.compare("Current accessibility : DSI0 : GRAYSCALE") || !contents.compare("4");
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus ReadingEnhancementExynos::setEnabled(bool enabled) {
|
||||
if (!WriteStringToFile(enabled ? "4" : "0", kREPath, true)) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
} // namespace samsung
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/strings.h>
|
||||
#include <livedisplay/samsung/SunlightEnhancement.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
using android::base::ReadFileToString;
|
||||
using android::base::Trim;
|
||||
using android::base::WriteStringToFile;
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace livedisplay {
|
||||
namespace samsung {
|
||||
|
||||
// Note: Exynos method is also available on Qualcomm
|
||||
static constexpr const char* kSREPath = "/sys/class/mdnie/mdnie/outdoor";
|
||||
|
||||
bool SunlightEnhancement::isSupported() {
|
||||
std::fstream file(kSREPath, file.in | file.out);
|
||||
return file.good();
|
||||
}
|
||||
|
||||
// Methods from ::aidl::vendor::lineage::livedisplay::BnSunlightEnhancement follow.
|
||||
ndk::ScopedAStatus SunlightEnhancement::getEnabled(bool* _aidl_return) {
|
||||
std::string tmp;
|
||||
int32_t contents = 0;
|
||||
|
||||
if (!ReadFileToString(kSREPath, &tmp)) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
contents = std::stoi(Trim(tmp));
|
||||
|
||||
*_aidl_return = contents == 1;
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus SunlightEnhancement::setEnabled(bool enabled) {
|
||||
if (!WriteStringToFile(enabled ? "1" : "0", kSREPath, true)) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
} // namespace samsung
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/strings.h>
|
||||
#include <livedisplay/samsung/SunlightEnhancementExynos.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
using android::base::ReadFileToString;
|
||||
using android::base::Trim;
|
||||
using android::base::WriteStringToFile;
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace livedisplay {
|
||||
namespace samsung {
|
||||
|
||||
static constexpr const char* kLUXPath = "/sys/class/mdnie/mdnie/lux";
|
||||
|
||||
bool SunlightEnhancementExynos::isSupported() {
|
||||
std::fstream file(kLUXPath, file.in | file.out);
|
||||
return file.good();
|
||||
}
|
||||
|
||||
// Methods from ::aidl::vendor::lineage::livedisplay::BnSunlightEnhancement follow.
|
||||
ndk::ScopedAStatus SunlightEnhancementExynos::getEnabled(bool* _aidl_return) {
|
||||
std::string tmp;
|
||||
int32_t contents = 0;
|
||||
|
||||
if (!ReadFileToString(kLUXPath, &tmp)) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
contents = std::stoi(Trim(tmp));
|
||||
|
||||
*_aidl_return = contents > 0;
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus SunlightEnhancementExynos::setEnabled(bool enabled) {
|
||||
/* see drivers/video/fbdev/exynos/decon_7880/panels/mdnie_lite_table*, get_hbm_index */
|
||||
if (!WriteStringToFile(enabled ? "40000" : "0", kLUXPath, true)) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
} // namespace samsung
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/vendor/lineage/livedisplay/BnAdaptiveBacklight.h>
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace livedisplay {
|
||||
namespace samsung {
|
||||
|
||||
class AdaptiveBacklight : public BnAdaptiveBacklight {
|
||||
public:
|
||||
bool isSupported();
|
||||
|
||||
// Methods from ::aidl::vendor::lineage::livedisplay::BnAdaptiveBacklight follow.
|
||||
ndk::ScopedAStatus getEnabled(bool* _aidl_return) override;
|
||||
ndk::ScopedAStatus setEnabled(bool enabled) override;
|
||||
};
|
||||
|
||||
} // namespace samsung
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/vendor/lineage/livedisplay/BnDisplayColorCalibration.h>
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace livedisplay {
|
||||
namespace samsung {
|
||||
|
||||
class DisplayColorCalibration : public BnDisplayColorCalibration {
|
||||
public:
|
||||
bool isSupported();
|
||||
|
||||
// Methods from ::aidl::vendor::lineage::livedisplay::BnDisplayColorCalibration follow.
|
||||
ndk::ScopedAStatus getMaxValue(int32_t* _aidl_return) override;
|
||||
ndk::ScopedAStatus getMinValue(int32_t* _aidl_return) override;
|
||||
ndk::ScopedAStatus getCalibration(std::vector<int32_t>* _aidl_return) override;
|
||||
ndk::ScopedAStatus setCalibration(const std::vector<int32_t>& rgb) override;
|
||||
};
|
||||
|
||||
} // namespace samsung
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/vendor/lineage/livedisplay/BnDisplayModes.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace livedisplay {
|
||||
namespace samsung {
|
||||
|
||||
class DisplayModes : public BnDisplayModes {
|
||||
public:
|
||||
DisplayModes();
|
||||
bool isSupported();
|
||||
|
||||
// Methods from ::aidl::vendor::lineage::livedisplay::BnDisplayModes follow.
|
||||
ndk::ScopedAStatus getDisplayModes(std::vector<DisplayMode>* _aidl_return) override;
|
||||
ndk::ScopedAStatus getCurrentDisplayMode(DisplayMode* _aidl_return) override;
|
||||
ndk::ScopedAStatus getDefaultDisplayMode(DisplayMode* _aidl_return) override;
|
||||
ndk::ScopedAStatus setDisplayMode(int32_t modeID, bool makeDefault) override;
|
||||
|
||||
private:
|
||||
static const std::map<int32_t, std::string> kModeMap;
|
||||
int32_t mDefaultModeId;
|
||||
};
|
||||
|
||||
} // namespace samsung
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/vendor/lineage/livedisplay/BnReadingEnhancement.h>
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace livedisplay {
|
||||
namespace samsung {
|
||||
|
||||
class ReadingEnhancementExynos : public BnReadingEnhancement {
|
||||
public:
|
||||
bool isSupported();
|
||||
|
||||
// Methods from ::aidl::vendor::lineage::livedisplay::BnReadingEnhancement follow.
|
||||
ndk::ScopedAStatus getEnabled(bool* _aidl_return) override;
|
||||
ndk::ScopedAStatus setEnabled(bool enabled) override;
|
||||
};
|
||||
|
||||
} // namespace samsung
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/vendor/lineage/livedisplay/BnSunlightEnhancement.h>
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace livedisplay {
|
||||
namespace samsung {
|
||||
|
||||
class SunlightEnhancement : public BnSunlightEnhancement {
|
||||
public:
|
||||
bool isSupported();
|
||||
|
||||
// Methods from ::aidl::vendor::lineage::livedisplay::BnSunlightEnhancement follow.
|
||||
ndk::ScopedAStatus getEnabled(bool* _aidl_return) override;
|
||||
ndk::ScopedAStatus setEnabled(bool enabled) override;
|
||||
};
|
||||
|
||||
} // namespace samsung
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/vendor/lineage/livedisplay/BnSunlightEnhancement.h>
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace livedisplay {
|
||||
namespace samsung {
|
||||
|
||||
class SunlightEnhancementExynos : public BnSunlightEnhancement {
|
||||
public:
|
||||
bool isSupported();
|
||||
|
||||
// Methods from ::aidl::vendor::lineage::livedisplay::BnSunlightEnhancement follow.
|
||||
ndk::ScopedAStatus getEnabled(bool* _aidl_return) override;
|
||||
ndk::ScopedAStatus setEnabled(bool enabled) override;
|
||||
};
|
||||
|
||||
} // namespace samsung
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define LOG_TAG "vendor.lineage.livedisplay-service.samsung-qcom"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <android/binder_process.h>
|
||||
#include <binder/ProcessState.h>
|
||||
#include <livedisplay/samsung/AdaptiveBacklight.h>
|
||||
#include <livedisplay/samsung/DisplayColorCalibration.h>
|
||||
#include <livedisplay/samsung/DisplayModes.h>
|
||||
#include <livedisplay/samsung/SunlightEnhancement.h>
|
||||
|
||||
using ::aidl::vendor::lineage::livedisplay::samsung::AdaptiveBacklight;
|
||||
using ::aidl::vendor::lineage::livedisplay::samsung::DisplayColorCalibration;
|
||||
using ::aidl::vendor::lineage::livedisplay::samsung::DisplayModes;
|
||||
using ::aidl::vendor::lineage::livedisplay::samsung::SunlightEnhancement;
|
||||
|
||||
int main() {
|
||||
android::ProcessState::self()->setThreadPoolMaxThreadCount(1);
|
||||
android::ProcessState::self()->startThreadPool();
|
||||
|
||||
std::shared_ptr<AdaptiveBacklight> adaptiveBacklight =
|
||||
ndk::SharedRefBase::make<AdaptiveBacklight>();
|
||||
std::shared_ptr<DisplayColorCalibration> displayColorCalibration =
|
||||
ndk::SharedRefBase::make<DisplayColorCalibration>();
|
||||
std::shared_ptr<DisplayModes> displayModes = ndk::SharedRefBase::make<DisplayModes>();
|
||||
std::shared_ptr<SunlightEnhancement> sunlightEnhancement =
|
||||
ndk::SharedRefBase::make<SunlightEnhancement>();
|
||||
binder_status_t status;
|
||||
|
||||
LOG(INFO) << "LiveDisplay HAL service is starting.";
|
||||
|
||||
if (adaptiveBacklight == nullptr) {
|
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL AdaptiveBacklight Iface, "
|
||||
"exiting.";
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
if (displayColorCalibration == nullptr) {
|
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayColorCalibration "
|
||||
"Iface, exiting.";
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
if (displayModes == nullptr) {
|
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayModes Iface, exiting.";
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
if (sunlightEnhancement == nullptr) {
|
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL SunlightEnhancement Iface, "
|
||||
"exiting.";
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
if (adaptiveBacklight->isSupported()) {
|
||||
std::string instance = std::string(AdaptiveBacklight::descriptor) + "/default";
|
||||
status = AServiceManager_addService(adaptiveBacklight->asBinder().get(), instance.c_str());
|
||||
if (status != STATUS_OK) {
|
||||
LOG(ERROR) << "Could not register service for LiveDisplay HAL AdaptiveBacklight Iface ("
|
||||
<< status << ")";
|
||||
goto shutdown;
|
||||
}
|
||||
}
|
||||
|
||||
if (displayColorCalibration->isSupported()) {
|
||||
std::string instance = std::string(DisplayColorCalibration::descriptor) + "/default";
|
||||
status = AServiceManager_addService(displayColorCalibration->asBinder().get(),
|
||||
instance.c_str());
|
||||
if (status != STATUS_OK) {
|
||||
LOG(ERROR) << "Could not register service for LiveDisplay HAL DisplayColorCalibration "
|
||||
"Iface ("
|
||||
<< status << ")";
|
||||
goto shutdown;
|
||||
}
|
||||
}
|
||||
|
||||
if (displayModes->isSupported()) {
|
||||
std::string instance = std::string(DisplayModes::descriptor) + "/default";
|
||||
status = AServiceManager_addService(displayModes->asBinder().get(), instance.c_str());
|
||||
if (status != STATUS_OK) {
|
||||
LOG(ERROR) << "Could not register service for LiveDisplay HAL DisplayModes Iface ("
|
||||
<< status << ")";
|
||||
goto shutdown;
|
||||
}
|
||||
}
|
||||
|
||||
if (sunlightEnhancement->isSupported()) {
|
||||
std::string instance = std::string(SunlightEnhancement::descriptor) + "/default";
|
||||
status =
|
||||
AServiceManager_addService(sunlightEnhancement->asBinder().get(), instance.c_str());
|
||||
if (status != STATUS_OK) {
|
||||
LOG(ERROR)
|
||||
<< "Could not register service for LiveDisplay HAL SunlightEnhancement Iface ("
|
||||
<< status << ")";
|
||||
goto shutdown;
|
||||
}
|
||||
}
|
||||
|
||||
LOG(INFO) << "LiveDisplay HAL service is ready.";
|
||||
ABinderProcess_joinThreadPool();
|
||||
|
||||
shutdown:
|
||||
// In normal operation, we don't expect the thread pool to shutdown
|
||||
LOG(ERROR) << "LiveDisplay HAL service is shutting down.";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define LOG_TAG "vendor.lineage.livedisplay-service.samsung-exynos"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <android/binder_process.h>
|
||||
#include <binder/ProcessState.h>
|
||||
#include <livedisplay/samsung/AdaptiveBacklight.h>
|
||||
#include <livedisplay/samsung/DisplayColorCalibration.h>
|
||||
#include <livedisplay/samsung/DisplayModes.h>
|
||||
#include <livedisplay/samsung/ReadingEnhancementExynos.h>
|
||||
#include <livedisplay/samsung/SunlightEnhancementExynos.h>
|
||||
|
||||
using ::aidl::vendor::lineage::livedisplay::samsung::AdaptiveBacklight;
|
||||
using ::aidl::vendor::lineage::livedisplay::samsung::DisplayColorCalibration;
|
||||
using ::aidl::vendor::lineage::livedisplay::samsung::DisplayModes;
|
||||
using ::aidl::vendor::lineage::livedisplay::samsung::ReadingEnhancementExynos;
|
||||
using ::aidl::vendor::lineage::livedisplay::samsung::SunlightEnhancementExynos;
|
||||
|
||||
int main() {
|
||||
android::ProcessState::self()->setThreadPoolMaxThreadCount(1);
|
||||
android::ProcessState::self()->startThreadPool();
|
||||
|
||||
std::shared_ptr<AdaptiveBacklight> adaptiveBacklight =
|
||||
ndk::SharedRefBase::make<AdaptiveBacklight>();
|
||||
std::shared_ptr<DisplayColorCalibration> displayColorCalibration =
|
||||
ndk::SharedRefBase::make<DisplayColorCalibration>();
|
||||
std::shared_ptr<DisplayModes> displayModes = ndk::SharedRefBase::make<DisplayModes>();
|
||||
std::shared_ptr<ReadingEnhancementExynos> readingEnhancement =
|
||||
ndk::SharedRefBase::make<ReadingEnhancementExynos>();
|
||||
std::shared_ptr<SunlightEnhancementExynos> sunlightEnhancement =
|
||||
ndk::SharedRefBase::make<SunlightEnhancementExynos>();
|
||||
binder_status_t status;
|
||||
|
||||
LOG(INFO) << "LiveDisplay HAL service is starting.";
|
||||
|
||||
if (adaptiveBacklight == nullptr) {
|
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL AdaptiveBacklight Iface, "
|
||||
"exiting.";
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
if (displayColorCalibration == nullptr) {
|
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayColorCalibration "
|
||||
"Iface, exiting.";
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
if (displayModes == nullptr) {
|
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayModes Iface, exiting.";
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
if (readingEnhancement == nullptr) {
|
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL ReadingEnhancement Iface, "
|
||||
"exiting.";
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
if (sunlightEnhancement == nullptr) {
|
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL SunlightEnhancement Iface, "
|
||||
"exiting.";
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
if (adaptiveBacklight->isSupported()) {
|
||||
std::string instance = std::string(AdaptiveBacklight::descriptor) + "/default";
|
||||
status = AServiceManager_addService(adaptiveBacklight->asBinder().get(), instance.c_str());
|
||||
if (status != STATUS_OK) {
|
||||
LOG(ERROR) << "Could not register service for LiveDisplay HAL AdaptiveBacklight Iface ("
|
||||
<< status << ")";
|
||||
goto shutdown;
|
||||
}
|
||||
}
|
||||
|
||||
if (displayColorCalibration->isSupported()) {
|
||||
std::string instance = std::string(DisplayColorCalibration::descriptor) + "/default";
|
||||
status = AServiceManager_addService(displayColorCalibration->asBinder().get(),
|
||||
instance.c_str());
|
||||
if (status != STATUS_OK) {
|
||||
LOG(ERROR) << "Could not register service for LiveDisplay HAL DisplayColorCalibration "
|
||||
"Iface ("
|
||||
<< status << ")";
|
||||
goto shutdown;
|
||||
}
|
||||
}
|
||||
|
||||
if (displayModes->isSupported()) {
|
||||
std::string instance = std::string(DisplayModes::descriptor) + "/default";
|
||||
status = AServiceManager_addService(displayModes->asBinder().get(), instance.c_str());
|
||||
if (status != STATUS_OK) {
|
||||
LOG(ERROR) << "Could not register service for LiveDisplay HAL DisplayModes Iface ("
|
||||
<< status << ")";
|
||||
goto shutdown;
|
||||
}
|
||||
}
|
||||
|
||||
if (readingEnhancement->isSupported()) {
|
||||
std::string instance = std::string(ReadingEnhancementExynos::descriptor) + "/default";
|
||||
status = AServiceManager_addService(readingEnhancement->asBinder().get(), instance.c_str());
|
||||
if (status != STATUS_OK) {
|
||||
LOG(ERROR)
|
||||
<< "Could not register service for LiveDisplay HAL ReadingEnhancement Iface ("
|
||||
<< status << ")";
|
||||
goto shutdown;
|
||||
}
|
||||
}
|
||||
|
||||
if (sunlightEnhancement->isSupported()) {
|
||||
std::string instance = std::string(SunlightEnhancementExynos::descriptor) + "/default";
|
||||
status =
|
||||
AServiceManager_addService(sunlightEnhancement->asBinder().get(), instance.c_str());
|
||||
if (status != STATUS_OK) {
|
||||
LOG(ERROR)
|
||||
<< "Could not register service for LiveDisplay HAL SunlightEnhancement Iface ("
|
||||
<< status << ")";
|
||||
goto shutdown;
|
||||
}
|
||||
}
|
||||
|
||||
LOG(INFO) << "LiveDisplay HAL service is ready.";
|
||||
ABinderProcess_joinThreadPool();
|
||||
|
||||
shutdown:
|
||||
// In normal operation, we don't expect the thread pool to shutdown
|
||||
LOG(ERROR) << "LiveDisplay HAL service is shutting down.";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
on post-fs-data
|
||||
mkdir /data/vendor/display 0770 system system
|
||||
|
||||
service vendor.livedisplay-hal-samsung-exynos /vendor/bin/hw/vendor.lineage.livedisplay-service.samsung-exynos
|
||||
class hal
|
||||
user system
|
||||
group system
|
||||
@@ -1,7 +0,0 @@
|
||||
on post-fs-data
|
||||
mkdir /data/vendor/display 0770 system system
|
||||
|
||||
service vendor.livedisplay-hal-samsung-qcom /vendor/bin/hw/vendor.lineage.livedisplay-service.samsung-qcom
|
||||
class late_start
|
||||
user system
|
||||
group system
|
||||
@@ -38,15 +38,11 @@ uint64_t readNode(const std::string node, pid_t pid) {
|
||||
|
||||
return out;
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
uint64_t GpuSysfsReader::getDmaBufGpuMem(pid_t pid) {
|
||||
return readNode(kDmaBufGpuMemNode, pid);
|
||||
}
|
||||
uint64_t GpuSysfsReader::getDmaBufGpuMem(pid_t pid) { return readNode(kDmaBufGpuMemNode, pid); }
|
||||
|
||||
uint64_t GpuSysfsReader::getGpuMemTotal(pid_t pid) {
|
||||
return readNode(kTotalGpuMemNode, pid);
|
||||
}
|
||||
uint64_t GpuSysfsReader::getGpuMemTotal(pid_t pid) { return readNode(kTotalGpuMemNode, pid); }
|
||||
|
||||
uint64_t GpuSysfsReader::getPrivateGpuMem(pid_t pid) {
|
||||
auto dma_buf_size = getDmaBufGpuMem(pid);
|
||||
|
||||
@@ -14,4 +14,4 @@ constexpr char kProcessDir[] = "kprcs";
|
||||
constexpr char kMappedDmaBufsDir[] = "dma_bufs";
|
||||
constexpr char kTotalGpuMemNode[] = "total_gpu_mem";
|
||||
constexpr char kDmaBufGpuMemNode[] = "dma_buf_gpu_mem";
|
||||
} // namespace GpuSysfsReader
|
||||
} // namespace GpuSysfsReader
|
||||
|
||||
@@ -18,26 +18,22 @@ namespace memtrack {
|
||||
|
||||
ndk::ScopedAStatus Memtrack::getMemory(int pid, MemtrackType type,
|
||||
std::vector<MemtrackRecord>* _aidl_return) {
|
||||
if (pid < 0) {
|
||||
if (pid < 0)
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_ILLEGAL_ARGUMENT));
|
||||
}
|
||||
|
||||
if (type != MemtrackType::OTHER && type != MemtrackType::GL && type != MemtrackType::GRAPHICS &&
|
||||
type != MemtrackType::MULTIMEDIA && type != MemtrackType::CAMERA) {
|
||||
type != MemtrackType::MULTIMEDIA && type != MemtrackType::CAMERA)
|
||||
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
|
||||
}
|
||||
|
||||
_aidl_return->clear();
|
||||
|
||||
// Other types are retained only for backward compatibility
|
||||
if (type != MemtrackType::GL && type != MemtrackType::GRAPHICS) {
|
||||
if (type != MemtrackType::GL && type != MemtrackType::GRAPHICS)
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
// pid 0 is only supported for GL type to report total private memory
|
||||
if (pid == 0 && type != MemtrackType::GL) {
|
||||
if (pid == 0 && type != MemtrackType::GL)
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
uint64_t size = 0;
|
||||
switch (type) {
|
||||
@@ -77,7 +73,7 @@ ndk::ScopedAStatus Memtrack::getGpuDeviceInfo(std::vector<DeviceInfo>* _aidl_ret
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
} // namespace memtrack
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
} // namespace memtrack
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
|
||||
@@ -12,14 +12,14 @@ namespace hardware {
|
||||
namespace memtrack {
|
||||
|
||||
class Memtrack : public BnMemtrack {
|
||||
public:
|
||||
public:
|
||||
ndk::ScopedAStatus getMemory(int pid, MemtrackType type,
|
||||
std::vector<MemtrackRecord>* _aidl_return) override;
|
||||
|
||||
ndk::ScopedAStatus getGpuDeviceInfo(std::vector<DeviceInfo>* _aidl_return) override;
|
||||
};
|
||||
|
||||
} // namespace memtrack
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
} // namespace memtrack
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
|
||||
@@ -19,18 +19,16 @@ bool exists(const path& p) {
|
||||
|
||||
bool is_directory(const path& p) {
|
||||
struct stat s;
|
||||
if (stat(p.string().c_str(), &s)) {
|
||||
if (stat(p.string().c_str(), &s))
|
||||
return false;
|
||||
}
|
||||
|
||||
return S_ISDIR(s.st_mode);
|
||||
}
|
||||
|
||||
bool is_symlink(const path& p) {
|
||||
struct stat s;
|
||||
if (lstat(p.string().c_str(), &s)) {
|
||||
if (lstat(p.string().c_str(), &s))
|
||||
return false;
|
||||
}
|
||||
|
||||
return S_ISLNK(s.st_mode);
|
||||
}
|
||||
@@ -47,9 +45,8 @@ path read_symlink(const path& p) {
|
||||
}
|
||||
|
||||
std::vector<directory_entry> directory_iterator(const path& p) {
|
||||
if (!exists(p) || !is_directory(p)) {
|
||||
if (!exists(p) || !is_directory(p))
|
||||
return {};
|
||||
}
|
||||
|
||||
std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(p.string().c_str()), &closedir);
|
||||
if (!dir) {
|
||||
@@ -59,9 +56,8 @@ std::vector<directory_entry> directory_iterator(const path& p) {
|
||||
std::vector<directory_entry> out;
|
||||
struct dirent* dent;
|
||||
while ((dent = readdir(dir.get()))) {
|
||||
if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) {
|
||||
if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
|
||||
continue;
|
||||
}
|
||||
|
||||
std::stringstream ss(p.string());
|
||||
ss << "/" << dent->d_name;
|
||||
@@ -71,4 +67,4 @@ std::vector<directory_entry> directory_iterator(const path& p) {
|
||||
return out;
|
||||
}
|
||||
|
||||
} // namespace filesystem
|
||||
} // namespace filesystem
|
||||
|
||||
@@ -16,12 +16,13 @@
|
||||
|
||||
namespace filesystem {
|
||||
class path {
|
||||
public:
|
||||
public:
|
||||
path(const std::string _path) : strPath(_path) {}
|
||||
|
||||
path filename() const {
|
||||
auto pos = strPath.rfind('/');
|
||||
if (pos == std::string::npos) return path(strPath);
|
||||
if (pos == std::string::npos)
|
||||
return path(strPath);
|
||||
|
||||
pos++;
|
||||
auto l = strPath.size();
|
||||
@@ -30,17 +31,19 @@ class path {
|
||||
|
||||
std::string string() const { return strPath; }
|
||||
|
||||
private:
|
||||
private:
|
||||
std::string strPath;
|
||||
};
|
||||
|
||||
class directory_entry {
|
||||
public:
|
||||
public:
|
||||
directory_entry(const std::string _path) : p(_path) {}
|
||||
|
||||
class path path() { return p; }
|
||||
class path path() {
|
||||
return p;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
class path p;
|
||||
};
|
||||
|
||||
@@ -54,4 +57,4 @@ path read_symlink(const path& p);
|
||||
|
||||
// Vector is easier to create than an iterator and serves our purposes well
|
||||
std::vector<directory_entry> directory_iterator(const path& p);
|
||||
} // namespace filesystem
|
||||
} // namespace filesystem
|
||||
|
||||
@@ -19,5 +19,5 @@ int main() {
|
||||
CHECK(status == STATUS_OK);
|
||||
|
||||
ABinderProcess_joinThreadPool();
|
||||
return EXIT_FAILURE; // Unreachable
|
||||
return EXIT_FAILURE; // Unreachable
|
||||
}
|
||||
|
||||
@@ -5,3 +5,4 @@
|
||||
<fqname>IMemtrack/default</fqname>
|
||||
</hal>
|
||||
</manifest>
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
//
|
||||
// SPDX-FileCopyrightText: 2025 The LineageOS Project
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
cc_binary {
|
||||
name: "vendor.lineage.powershare-service.samsung",
|
||||
defaults: ["samsung_header_path_defaults"],
|
||||
vintf_fragments: ["vendor.lineage.powershare-service.samsung.xml"],
|
||||
init_rc: ["vendor.lineage.powershare-service.samsung.rc"],
|
||||
vendor: true,
|
||||
relative_install_path: "hw",
|
||||
srcs: [
|
||||
"PowerShare.cpp",
|
||||
"service.cpp",
|
||||
],
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"liblog",
|
||||
"libbinder_ndk",
|
||||
"libutils",
|
||||
"vendor.lineage.powershare-V1-ndk",
|
||||
],
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define LOG_TAG "vendor.lineage.powershare-service.samsung"
|
||||
|
||||
#include "PowerShare.h"
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android-base/strings.h>
|
||||
|
||||
#include <samsung_powershare.h>
|
||||
|
||||
using ::android::base::ReadFileToString;
|
||||
using ::android::base::Trim;
|
||||
using ::android::base::WriteStringToFile;
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace powershare {
|
||||
|
||||
ndk::ScopedAStatus PowerShare::getMinBattery(int32_t* _aidl_return) {
|
||||
std::string value;
|
||||
if (!ReadFileToString(POWERSHARE_STOP_CAPACITY_PATH, &value)) {
|
||||
LOG(ERROR) << "Failed to get PowerShare minimum battery level";
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
|
||||
*_aidl_return = std::stoi(value);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus PowerShare::isEnabled(bool* _aidl_return) {
|
||||
std::string value;
|
||||
if (!ReadFileToString(POWERSHARE_PATH, &value)) {
|
||||
LOG(ERROR) << "Failed to read current PowerShare state";
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
|
||||
*_aidl_return = Trim(value) == POWERSHARE_ENABLED;
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus PowerShare::setEnabled(bool enable) {
|
||||
std::string value = enable ? POWERSHARE_ENABLED : POWERSHARE_DISABLED;
|
||||
if (!WriteStringToFile(value, POWERSHARE_PATH)) {
|
||||
LOG(ERROR) << "Failed to write PowerShare state";
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_SERVICE_SPECIFIC);
|
||||
}
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus PowerShare::setMinBattery(int32_t minBattery) {
|
||||
if (!WriteStringToFile(std::to_string(minBattery), POWERSHARE_STOP_CAPACITY_PATH)) {
|
||||
LOG(ERROR) << "Failed to set PowerShare minimum battery level";
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_SERVICE_SPECIFIC);
|
||||
}
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
} // namespace powershare
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/vendor/lineage/powershare/BnPowerShare.h>
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace powershare {
|
||||
|
||||
class PowerShare : public BnPowerShare {
|
||||
public:
|
||||
ndk::ScopedAStatus getMinBattery(int32_t* _aidl_return) override;
|
||||
ndk::ScopedAStatus isEnabled(bool* _aidl_return) override;
|
||||
ndk::ScopedAStatus setEnabled(bool enable) override;
|
||||
ndk::ScopedAStatus setMinBattery(int32_t minBattery) override;
|
||||
};
|
||||
|
||||
} // namespace powershare
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
@@ -1,12 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define POWERSHARE_DISABLED "0"
|
||||
#define POWERSHARE_ENABLED "1"
|
||||
|
||||
#define POWERSHARE_PATH "/sys/class/power_supply/battery/wc_tx_en"
|
||||
#define POWERSHARE_STOP_CAPACITY_PATH "/sys/class/power_supply/battery/wc_tx_stop_capacity"
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "PowerShare.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <android/binder_process.h>
|
||||
|
||||
using aidl::vendor::lineage::powershare::PowerShare;
|
||||
|
||||
int main() {
|
||||
ABinderProcess_setThreadPoolMaxThreadCount(0);
|
||||
std::shared_ptr<PowerShare> powershare = ndk::SharedRefBase::make<PowerShare>();
|
||||
|
||||
const std::string instance = std::string(PowerShare::descriptor) + "/default";
|
||||
binder_status_t status =
|
||||
AServiceManager_addService(powershare->asBinder().get(), instance.c_str());
|
||||
CHECK_EQ(status, STATUS_OK);
|
||||
|
||||
ABinderProcess_joinThreadPool();
|
||||
return EXIT_FAILURE; // should not reach
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
on init
|
||||
chown system system /sys/class/power_supply/battery/wc_tx_en
|
||||
chown system system /sys/class/power_supply/battery/wc_tx_stop_capacity
|
||||
chmod 0664 /sys/class/power_supply/battery/wc_tx_en
|
||||
chmod 0664 /sys/class/power_supply/battery/wc_tx_stop_capacity
|
||||
|
||||
service vendor.powershare-hal /vendor/bin/hw/vendor.lineage.powershare-service.samsung
|
||||
class hal
|
||||
user system
|
||||
group system
|
||||
@@ -1,7 +0,0 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl">
|
||||
<name>vendor.lineage.powershare</name>
|
||||
<version>1</version>
|
||||
<fqname>IPowerShare/default</fqname>
|
||||
</hal>
|
||||
</manifest>
|
||||
@@ -32,7 +32,7 @@ cc_binary {
|
||||
"android.hardware.sensors@2.0",
|
||||
"android.hardware.sensors@2.0-ScopedWakelock",
|
||||
"android.hardware.sensors@2.1",
|
||||
"android.hardware.sensors-V3-ndk",
|
||||
"android.hardware.sensors-V2-ndk",
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"libcutils",
|
||||
@@ -49,9 +49,3 @@ cc_binary {
|
||||
"libaidlcommonsupport",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "sensors.sensorhub_wait_for_mcu",
|
||||
srcs: ["SensorHubWaitForMCUInit.cpp"],
|
||||
vendor: true,
|
||||
}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <chrono>
|
||||
#include <fstream>
|
||||
#include <thread>
|
||||
|
||||
extern "C" void* sensorsHalGetSubHal(uint32_t* version) {
|
||||
static auto sensorsHalGetSubHalOrig = reinterpret_cast<typeof(sensorsHalGetSubHal)*>(
|
||||
dlsym(dlopen("sensors.sensorhub.so", RTLD_NOW), "sensorsHalGetSubHal"));
|
||||
|
||||
while (true) {
|
||||
std::ifstream mcu_test("/sys/devices/virtual/sensors/ssp_sensor/mcu_test");
|
||||
|
||||
if (mcu_test) {
|
||||
std::string value;
|
||||
mcu_test >> value;
|
||||
|
||||
if (value.ends_with(",OK")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
|
||||
return sensorsHalGetSubHalOrig(version);
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl" override="true">
|
||||
<name>android.hardware.sensors</name>
|
||||
<version>3</version>
|
||||
<version>2</version>
|
||||
<fqname>ISensors/default</fqname>
|
||||
</hal>
|
||||
</manifest>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
//
|
||||
// SPDX-FileCopyrightText: 2025 The LineageOS Project
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
cc_binary {
|
||||
name: "vendor.lineage.touch-service.samsung",
|
||||
defaults: ["samsung_header_path_defaults"],
|
||||
init_rc: ["vendor.lineage.touch-service.samsung.rc"],
|
||||
relative_install_path: "hw",
|
||||
proprietary: true,
|
||||
srcs: [
|
||||
"GloveMode.cpp",
|
||||
"HighTouchPollingRate.cpp",
|
||||
"KeyDisabler.cpp",
|
||||
"StylusMode.cpp",
|
||||
"TouchscreenGesture.cpp",
|
||||
"service.cpp",
|
||||
],
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"liblog",
|
||||
"libbinder_ndk",
|
||||
"libutils",
|
||||
"vendor.lineage.touch-V1-ndk",
|
||||
],
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "GloveMode.h"
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace touch {
|
||||
|
||||
bool GloveMode::isSupported() {
|
||||
std::ifstream file(TSP_CMD_LIST_NODE);
|
||||
if (file.is_open()) {
|
||||
std::string line;
|
||||
while (getline(file, line)) {
|
||||
if (!line.compare("glove_mode")) return true;
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus GloveMode::getEnabled(bool* _aidl_return) {
|
||||
std::ifstream file(TSP_CMD_RESULT_NODE);
|
||||
if (file.is_open()) {
|
||||
std::string line;
|
||||
getline(file, line);
|
||||
*_aidl_return = !line.compare("glove_mode,1:OK");
|
||||
file.close();
|
||||
}
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus GloveMode::setEnabled(bool enabled) {
|
||||
std::ofstream file(TSP_CMD_NODE);
|
||||
file << "glove_mode," << (enabled ? "1" : "0");
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
} // namespace touch
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/vendor/lineage/touch/BnGloveMode.h>
|
||||
#include <samsung_touch.h>
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace touch {
|
||||
|
||||
class GloveMode : public BnGloveMode {
|
||||
public:
|
||||
bool isSupported();
|
||||
|
||||
ndk::ScopedAStatus getEnabled(bool* _aidl_return) override;
|
||||
ndk::ScopedAStatus setEnabled(bool enabled) override;
|
||||
};
|
||||
|
||||
} // namespace touch
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "HighTouchPollingRate.h"
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace touch {
|
||||
|
||||
bool HighTouchPollingRate::isSupported() {
|
||||
return !mHtprCmd.empty();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus HighTouchPollingRate::getEnabled(bool* _aidl_return) {
|
||||
std::ifstream file(TSP_CMD_RESULT_NODE);
|
||||
if (file.is_open()) {
|
||||
std::string line;
|
||||
getline(file, line);
|
||||
*_aidl_return = !line.compare(mHtprCmd + ",1:OK");
|
||||
file.close();
|
||||
}
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus HighTouchPollingRate::setEnabled(bool enabled) {
|
||||
std::ofstream file(TSP_CMD_NODE);
|
||||
file << (mHtprCmd + ",") << (enabled ? "1" : "0");
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
} // namespace touch
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/vendor/lineage/touch/BnHighTouchPollingRate.h>
|
||||
#include <samsung_touch.h>
|
||||
#include <fstream>
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace touch {
|
||||
|
||||
class HighTouchPollingRate : public BnHighTouchPollingRate {
|
||||
public:
|
||||
HighTouchPollingRate() {
|
||||
std::ifstream file(TSP_CMD_LIST_NODE);
|
||||
if (file.is_open()) {
|
||||
mHtprCmd = "";
|
||||
std::string line;
|
||||
while (getline(file, line)) {
|
||||
if (!line.compare("set_game_mode") || !line.compare("set_scan_rate")) {
|
||||
mHtprCmd = line;
|
||||
break;
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
bool isSupported();
|
||||
|
||||
ndk::ScopedAStatus getEnabled(bool* _aidl_return) override;
|
||||
ndk::ScopedAStatus setEnabled(bool enabled) override;
|
||||
|
||||
private:
|
||||
std::string mHtprCmd;
|
||||
};
|
||||
|
||||
} // namespace touch
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "KeyDisabler.h"
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace touch {
|
||||
|
||||
bool KeyDisabler::isSupported() {
|
||||
std::ofstream file(KEY_DISABLER_NODE);
|
||||
return file.good();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus KeyDisabler::getEnabled(bool* _aidl_return) {
|
||||
std::ifstream file(KEY_DISABLER_NODE);
|
||||
int status = -1;
|
||||
|
||||
if (file.is_open()) {
|
||||
file >> status;
|
||||
}
|
||||
|
||||
*_aidl_return = status == 0;
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus KeyDisabler::setEnabled(bool enabled) {
|
||||
std::ofstream file(KEY_DISABLER_NODE);
|
||||
file << (enabled ? "0" : "1");
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
} // namespace touch
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user