Compare commits
144 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce1bf5c27f | ||
|
|
44c057f60b | ||
|
|
474ebe1722 | ||
|
|
c7abe693bd | ||
|
|
ef4647e636 | ||
|
|
4b128b05b3 | ||
|
|
6157fb0df0 | ||
|
|
d87a8f30a4 | ||
|
|
211e5f0b1a | ||
|
|
f76655d7bc | ||
|
|
0073e77169 | ||
|
|
661a74dc6a | ||
|
|
7063bcad23 | ||
|
|
00809a12b0 | ||
|
|
9d8b250ce5 | ||
|
|
8aba80de2b | ||
|
|
33f74940ad | ||
|
|
b2f5a8db8d | ||
|
|
df0812cd0b | ||
|
|
4881519b23 | ||
|
|
96cec7c200 | ||
|
|
1c29fd2599 | ||
|
|
2326b7c10b | ||
|
|
1ff326fde4 | ||
|
|
078d67d671 | ||
|
|
d29b39b66a | ||
|
|
b0416d32bc | ||
|
|
1b4d8a2b03 | ||
|
|
354ca305ca | ||
|
|
923942619f | ||
|
|
33ccfec6cf | ||
|
|
9cc8f56671 | ||
| e1ebb45e3c | |||
|
|
c65e8a6f0f | ||
|
|
699a741aa9 | ||
|
|
403a57cc0d | ||
| 08cfc0cbc2 | |||
|
|
e1873e9df4 | ||
|
|
0c4a57235f | ||
| 0426336593 | |||
|
|
04da539900 | ||
|
|
9f2dfb966f | ||
|
|
121dddc138 | ||
|
|
d72d21d4ca | ||
|
|
73dc774852 | ||
|
|
888b1252e0 | ||
|
|
4dd00a62d7 | ||
|
|
f8f8b96472 | ||
|
|
2af299f594 | ||
|
|
de83d093e6 | ||
|
|
efaf58c10a | ||
|
|
098923d64e | ||
|
|
edf680575b | ||
|
|
876585001b | ||
|
|
c111b52360 | ||
|
|
5074e1b915 | ||
|
|
608872573b | ||
|
|
d4c580a5bc | ||
|
|
1940e53398 | ||
|
|
cd805062ff | ||
|
|
ca6f97fb2d | ||
|
|
9627fa4826 | ||
|
|
e132bfadd8 | ||
|
|
f4dd7d73f4 | ||
|
|
cb586c51f4 | ||
|
|
db3ce29c77 | ||
|
|
a72f98f12b | ||
|
|
9ab477d63c | ||
|
|
25f925f7a9 | ||
|
|
38094acf43 | ||
|
|
2ea1e8f703 | ||
|
|
e3d545c8da | ||
|
|
a44a822af0 | ||
|
|
e3839f6b7b | ||
|
|
357a8e58ca | ||
|
|
7ef731eaa4 | ||
|
|
6c6f615011 | ||
|
|
6814d040e7 | ||
|
|
e4c91fae34 | ||
|
|
60c28a403e | ||
|
|
466bdfd7f9 | ||
|
|
e79e9239e1 | ||
|
|
7775731b3f | ||
|
|
0eb9d4c527 | ||
|
|
20a7e57a5a | ||
|
|
b8abadb785 | ||
|
|
8e2b9ef1d7 | ||
|
|
1b790d2d48 | ||
|
|
aa75d8dbca | ||
|
|
0654e55600 | ||
|
|
20ba9e3a9f | ||
|
|
21ca8468cd | ||
|
|
9ce1aad47c | ||
|
|
6f507d907d | ||
|
|
c2b048b0ba | ||
|
|
a05c5586d6 | ||
|
|
e768dfd9e7 | ||
|
|
e084eb593f | ||
|
|
f66e03c015 | ||
|
|
fca7d19da0 | ||
|
|
c6c9c0a95d | ||
|
|
0160b1d635 | ||
|
|
7970b54542 | ||
|
|
7b96104345 | ||
|
|
c562f5037c | ||
|
|
e039a221cf | ||
|
|
86d3d9e494 | ||
|
|
40267448b8 | ||
|
|
9e92719095 | ||
|
|
1a82c7b700 | ||
|
|
8f880d69b0 | ||
|
|
931340ff18 | ||
|
|
6a8f052b13 | ||
|
|
bd98acb3f6 | ||
|
|
f578c79f84 | ||
|
|
e77198f821 | ||
|
|
2490de1f76 | ||
|
|
dc3b4b368a | ||
|
|
dc6fc85dbc | ||
|
|
635168b492 | ||
|
|
92ba912eaa | ||
|
|
24a95a3347 | ||
|
|
7516bae991 | ||
|
|
a6cc5c543d | ||
|
|
8fdab0127b | ||
|
|
c50248a1ac | ||
|
|
2f7d0cf7c0 | ||
|
|
838f6c7a0c | ||
|
|
833a0b62b4 | ||
|
|
d218757325 | ||
|
|
ad61fd8001 | ||
|
|
9fbc3a3667 | ||
|
|
f7b6bc1a81 | ||
|
|
c4c9b3520c | ||
|
|
dca8ebaf57 | ||
|
|
b22e45c386 | ||
|
|
02dbe51831 | ||
|
|
f42484e931 | ||
|
|
082a0b2810 | ||
|
|
ac076a6da3 | ||
|
|
dbf51b317c | ||
|
|
6b55511e98 | ||
|
|
bdf34c8aa4 | ||
|
|
9f252a234a |
@@ -1 +0,0 @@
|
||||
../../build/soong/scripts/system-clang-format
|
||||
13
.clang-format
Normal file
13
.clang-format
Normal file
@@ -0,0 +1,13 @@
|
||||
BasedOnStyle: Google
|
||||
Standard: Cpp11
|
||||
AccessModifierOffset: -2
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
ColumnLimit: 100
|
||||
CommentPragmas: NOLINT:.*
|
||||
DerivePointerAlignment: false
|
||||
IncludeBlocks: Preserve
|
||||
IndentWidth: 4
|
||||
ContinuationIndentWidth: 8
|
||||
PointerAlignment: Left
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
13
.github/workflows/build/action.yml
vendored
Normal file
13
.github/workflows/build/action.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
name: build
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: pip install pre-commit
|
||||
|
||||
- name: Lint
|
||||
shell: bash
|
||||
run: pre-commit run --all
|
||||
38
.github/workflows/gerrit.yml
vendored
Normal file
38
.github/workflows/gerrit.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
name: gerrit checks
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
ref:
|
||||
type: string
|
||||
gerrit-ref:
|
||||
type: string
|
||||
change:
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: lineageos-infra/fetch-gerrit-change@main
|
||||
with:
|
||||
gerrit-ref: ${{ inputs.gerrit-ref }}
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
- name: Check if build/action.yml exists
|
||||
id: check
|
||||
run: |
|
||||
if [ -f ./.github/workflows/build/action.yml ]; then
|
||||
echo "run=1" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Build
|
||||
if: ${{ steps.check.outputs.run }}
|
||||
uses: ./.github/workflows/build
|
||||
|
||||
- uses: lineageos-infra/gerrit-vote@main
|
||||
if: ${{ steps.check.outputs.run && always() }}
|
||||
with:
|
||||
auth: ${{ secrets.GERRIT_VOTE_CREDS }}
|
||||
change: ${{ inputs.change }}
|
||||
ref: ${{ inputs.ref }}
|
||||
20
.pre-commit-config.yaml
Normal file
20
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v6.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-added-large-files
|
||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||
rev: v21.1.8
|
||||
hooks:
|
||||
- id: clang-format
|
||||
types_or: [c, c++]
|
||||
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
|
||||
rev: v2.15.0
|
||||
hooks:
|
||||
- id: pretty-format-kotlin
|
||||
args: [--autofix, --ktfmt, --ktfmt-style=kotlinlang]
|
||||
@@ -8,7 +8,7 @@ android_app {
|
||||
name: "AdvancedDisplay",
|
||||
|
||||
srcs: ["src/**/*.java"],
|
||||
resource_dirs: ["res"],
|
||||
|
||||
certificate: "platform",
|
||||
platform_apis: true,
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
<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,5 +1,3 @@
|
||||
-keepclasseswithmembers class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet);
|
||||
}
|
||||
|
||||
-keep class ** extends android.support.v14.preference.PreferenceFragment
|
||||
|
||||
1
AdvancedDisplay/res/layout/framelayout.xml
Executable file → Normal file
1
AdvancedDisplay/res/layout/framelayout.xml
Executable file → Normal file
@@ -2,4 +2,3 @@
|
||||
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">Ə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_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_scenario_ui">LineageOS (ilkin)</string>
|
||||
<string name="mdnie_scenario_video">Video</string>
|
||||
<string name="mdnie_scenario_video_warm">Video - isti</string>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
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>
|
||||
@@ -26,6 +25,7 @@
|
||||
<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,5 +33,12 @@
|
||||
<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,4 +21,24 @@
|
||||
<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>
|
||||
|
||||
44
AdvancedDisplay/res/values-ga-rIE/strings.xml
Normal file
44
AdvancedDisplay/res/values-ga-rIE/strings.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?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,6 +22,7 @@
|
||||
<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>
|
||||
@@ -37,4 +38,7 @@
|
||||
<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">Defina o cenário mDNIe</string>
|
||||
<string name="mdnie_scenario_summary_head">Configure o cenário mDNIe</string>
|
||||
<string name="mdnie_accessibility_title_head">Modo de acessibilidade</string>
|
||||
<string name="mdnie_accessibility_summary_head">Definir o modo de acessibilidade do mDNIe</string>
|
||||
<string name="mdnie_accessibility_summary_head">Configure 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">e-book</string>
|
||||
<string name="mdnie_scenario_ebook">eBook</string>
|
||||
<string name="mdnie_scenario_email">E-mail</string>
|
||||
<string name="mdnie_scenario_tdmb">Televisão digital</string>
|
||||
<string name="mdnie_scenario_tdmb">TV 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,7 +16,27 @@
|
||||
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,4 +21,17 @@
|
||||
<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,4 +21,24 @@
|
||||
<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);
|
||||
|
||||
getFragmentManager().beginTransaction().replace(
|
||||
getSupportFragmentManager().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.PreferenceFragment;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
|
||||
import org.lineageos.settings.device.R;
|
||||
|
||||
import org.lineageos.internal.util.FileUtils;
|
||||
|
||||
public class AdvancedDisplayFragment extends PreferenceFragment {
|
||||
public class AdvancedDisplayFragment extends PreferenceFragmentCompat {
|
||||
private mDNIeScenario mmDNIeScenario;
|
||||
private mDNIeAccessibility mmDNIeAccessibility;
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
addPreferencesFromResource(R.xml.screen_preferences);
|
||||
setPreferencesFromResource(R.xml.screen_preferences, rootKey);
|
||||
Resources res = getResources();
|
||||
|
||||
/* mDNIe */
|
||||
|
||||
43
Android.mk
43
Android.mk
@@ -1,43 +0,0 @@
|
||||
# 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,10 +1,15 @@
|
||||
//
|
||||
// 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",
|
||||
@@ -30,14 +35,9 @@ 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,13 +66,16 @@ 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,3 +1,8 @@
|
||||
//
|
||||
// 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,7 +1573,6 @@ typedef enum camera3_stream_configuration_mode {
|
||||
* types) see the usage field below.
|
||||
*/
|
||||
typedef struct camera3_stream {
|
||||
|
||||
/*****
|
||||
* Set by framework before configure_streams()
|
||||
*/
|
||||
@@ -1674,7 +1673,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
|
||||
@@ -1760,7 +1759,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];
|
||||
@@ -1793,7 +1792,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:
|
||||
@@ -1821,7 +1820,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;
|
||||
|
||||
/**
|
||||
@@ -1858,12 +1857,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
|
||||
@@ -1899,7 +1898,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
|
||||
@@ -1947,7 +1946,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
|
||||
@@ -1961,7 +1960,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;
|
||||
|
||||
@@ -2105,7 +2104,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.
|
||||
@@ -2140,7 +2139,6 @@ 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.
|
||||
*/
|
||||
@@ -2166,7 +2164,6 @@ typedef struct camera3_notify_msg {
|
||||
|
||||
} camera3_notify_msg_t;
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* Types definition for request_stream_buffers() callback.
|
||||
@@ -2278,7 +2275,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
|
||||
@@ -2290,7 +2287,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
|
||||
@@ -2309,10 +2306,9 @@ 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()
|
||||
@@ -2410,7 +2406,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.
|
||||
@@ -2436,7 +2432,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
|
||||
@@ -2463,7 +2459,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:
|
||||
@@ -2488,7 +2484,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:
|
||||
@@ -2501,7 +2497,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;
|
||||
|
||||
@@ -2554,7 +2550,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;
|
||||
|
||||
/**
|
||||
@@ -2582,7 +2578,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
|
||||
@@ -2632,84 +2628,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;
|
||||
|
||||
@@ -2726,7 +2722,6 @@ typedef struct camera3_capture_result {
|
||||
*
|
||||
*/
|
||||
typedef struct camera3_callback_ops {
|
||||
|
||||
/**
|
||||
* process_capture_result:
|
||||
*
|
||||
@@ -2794,8 +2789,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:
|
||||
@@ -2827,8 +2822,7 @@ 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:
|
||||
@@ -2864,11 +2858,10 @@ 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:
|
||||
@@ -2884,10 +2877,8 @@ 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;
|
||||
|
||||
@@ -2897,7 +2888,6 @@ typedef struct camera3_callback_ops {
|
||||
*
|
||||
*/
|
||||
typedef struct camera3_device_ops {
|
||||
|
||||
/**
|
||||
* initialize:
|
||||
*
|
||||
@@ -2917,8 +2907,7 @@ 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
|
||||
@@ -3156,8 +3145,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:
|
||||
@@ -3210,8 +3199,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
|
||||
@@ -3246,9 +3235,8 @@ 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:
|
||||
@@ -3316,8 +3304,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
|
||||
@@ -3338,8 +3326,7 @@ 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:
|
||||
@@ -3359,7 +3346,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:
|
||||
@@ -3432,10 +3419,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
|
||||
@@ -3465,7 +3452,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:
|
||||
@@ -3487,9 +3474,8 @@ 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:
|
||||
@@ -3538,11 +3524,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;
|
||||
|
||||
/**********************************************************************
|
||||
@@ -3563,8 +3549,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 <stdint.h>
|
||||
#include <cutils/native_handle.h>
|
||||
#include <hardware/gralloc.h>
|
||||
#include <hardware/hardware.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.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,6 +36,11 @@ __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
|
||||
@@ -157,11 +162,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)
|
||||
@@ -257,7 +262,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
|
||||
@@ -611,7 +616,6 @@ typedef enum torch_mode_status {
|
||||
|
||||
*/
|
||||
typedef struct camera_module_callbacks {
|
||||
|
||||
/**
|
||||
* camera_device_status_change:
|
||||
*
|
||||
@@ -632,9 +636,8 @@ 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:
|
||||
@@ -655,10 +658,8 @@ 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;
|
||||
|
||||
@@ -796,7 +797,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
|
||||
@@ -906,7 +907,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.
|
||||
@@ -945,10 +946,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.
|
||||
@@ -992,7 +993,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:
|
||||
@@ -1058,8 +1059,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:
|
||||
@@ -1175,8 +1176,7 @@ 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,35 +1,18 @@
|
||||
//
|
||||
// Copyright (C) 2024 The LineageOS Project
|
||||
//
|
||||
// SPDX-FileCopyrightText: 2024-2026 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: [
|
||||
"extra_id_defaults",
|
||||
"samsung_camera3_defaults"
|
||||
],
|
||||
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,10 +183,13 @@ bool CameraProvider::initCamera(int id) {
|
||||
|
||||
bool CameraProvider::initialize() {
|
||||
camera_module_t* rawModule;
|
||||
int err = hw_get_module(CAMERA_HARDWARE_MODULE_ID, (const hw_module_t**)&rawModule);
|
||||
int err = hw_get_module(SEC_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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
mModule = new SamsungCameraModule(rawModule);
|
||||
@@ -221,7 +224,7 @@ bool CameraProvider::initialize() {
|
||||
}
|
||||
std::vector<int> extraIDs = {
|
||||
#ifdef EXTRA_IDS
|
||||
EXTRA_IDS
|
||||
EXTRA_IDS
|
||||
#endif
|
||||
};
|
||||
for (int i : extraIDs) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.camera.provider</name>
|
||||
<version>1</version>
|
||||
<fqname>ICameraProvider/internal/0</fqname>
|
||||
</hal>
|
||||
</manifest>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
* Copyright (C) 2024-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.
|
||||
@@ -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
|
||||
|
||||
88
aidl/codec2/Android.bp
Normal file
88
aidl/codec2/Android.bp
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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"],
|
||||
}
|
||||
6
aidl/codec2/android.software.media.c2-service.samsung.rc
Normal file
6
aidl/codec2/android.software.media.c2-service.samsung.rc
Normal file
@@ -0,0 +1,6 @@
|
||||
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
|
||||
18
aidl/codec2/samsung_media_c2_default.xml
Normal file
18
aidl/codec2/samsung_media_c2_default.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<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 +1,11 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="hidl">
|
||||
<name>vendor.lineage.fastcharge</name>
|
||||
<hal format="hidl" override="true">
|
||||
<name>android.hardware.media.c2</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IFastCharge</name>
|
||||
<name>IComponentStore</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</hal>
|
||||
</manifest>
|
||||
11
aidl/codec2/samsung_media_c2_legacy_default0.xml
Normal file
11
aidl/codec2/samsung_media_c2_legacy_default0.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<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>
|
||||
@@ -0,0 +1,86 @@
|
||||
# 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
|
||||
@@ -0,0 +1,80 @@
|
||||
# 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
|
||||
@@ -0,0 +1,74 @@
|
||||
# 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
|
||||
@@ -0,0 +1,71 @@
|
||||
# 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
|
||||
@@ -0,0 +1,71 @@
|
||||
# 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
|
||||
100
aidl/codec2/vendor.cpp
Normal file
100
aidl/codec2/vendor.cpp
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 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,16 +12,14 @@ 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,9 +75,8 @@ 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;
|
||||
@@ -109,34 +108,38 @@ 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};
|
||||
|
||||
SensorLocation sensorLocation;
|
||||
std::vector<SensorLocation> sensorLocations;
|
||||
std::string loc = FingerprintHalProperties::sensor_location().value_or("");
|
||||
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);
|
||||
std::vector<std::string> sensors = Split(loc, ";");
|
||||
|
||||
if (dim.size() >= 4)
|
||||
sensorLocation.display = dim[3];
|
||||
} else if(loc.length() > 0) {
|
||||
LOG(WARNING) << "Invalid sensor location input (x|y|radius|display): " << loc;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
LOG(INFO) << "Sensor type: " << ::android::internal::ToString(mSensorType)
|
||||
<< " location: " << sensorLocation.toString();
|
||||
LOG(INFO) << "Sensor type: " << ::android::internal::ToString(mSensorType) << " locations:";
|
||||
for (const auto& sensorLocation : sensorLocations) {
|
||||
LOG(INFO) << sensorLocation.toString();
|
||||
}
|
||||
|
||||
*out = {{commonProps,
|
||||
mSensorType,
|
||||
{sensorLocation},
|
||||
mSupportsGestures,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
*out = {{commonProps, mSensorType, sensorLocations, mSupportsGestures, false, false, false,
|
||||
std::nullopt}};
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
@@ -157,8 +160,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;
|
||||
}
|
||||
@@ -177,9 +180,8 @@ 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;
|
||||
@@ -225,8 +227,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 @@ private:
|
||||
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,15 +36,13 @@ 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,39 +19,40 @@ 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;
|
||||
@@ -76,8 +77,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,11 +32,12 @@ public:
|
||||
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 "Fingerprint.h"
|
||||
#include "LockoutTracker.h"
|
||||
#include "Fingerprint.h"
|
||||
|
||||
#include <util/Util.h>
|
||||
|
||||
@@ -16,8 +16,9 @@ namespace biometrics {
|
||||
namespace fingerprint {
|
||||
|
||||
void LockoutTracker::reset(bool clearAttemptCounter) {
|
||||
if (clearAttemptCounter)
|
||||
if (clearAttemptCounter) {
|
||||
mFailedCount = 0;
|
||||
}
|
||||
mLockoutTimedStart = 0;
|
||||
mCurrentMode = LockoutMode::NONE;
|
||||
}
|
||||
@@ -25,9 +26,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();
|
||||
}
|
||||
@@ -56,8 +57,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,11 +1,13 @@
|
||||
/*
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
* Copyright (C) 2024-2025 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace aidl {
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
@@ -16,27 +18,23 @@ 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,10 +36,7 @@ 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];
|
||||
@@ -122,8 +119,9 @@ 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];
|
||||
@@ -135,8 +133,9 @@ 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);
|
||||
@@ -155,8 +154,9 @@ 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,8 +368,7 @@ 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();
|
||||
@@ -379,8 +378,9 @@ void Session::startLockoutTimer(int64_t timeout) {
|
||||
}
|
||||
|
||||
void Session::lockoutTimerExpired() {
|
||||
if (!mIsLockoutTimerAborted)
|
||||
if (!mIsLockoutTimerAborted) {
|
||||
clearLockout(false);
|
||||
}
|
||||
|
||||
mIsLockoutTimerStarted = false;
|
||||
mIsLockoutTimerAborted = false;
|
||||
@@ -397,18 +397,19 @@ 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
|
||||
@@ -458,8 +459,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,8 +39,7 @@ public:
|
||||
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;
|
||||
@@ -51,15 +50,13 @@ public:
|
||||
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;
|
||||
@@ -69,11 +66,10 @@ public:
|
||||
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;
|
||||
@@ -102,8 +98,8 @@ private:
|
||||
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 hal
|
||||
class late_start
|
||||
user system
|
||||
group system input uhid
|
||||
shutdown critical
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.biometrics.fingerprint</name>
|
||||
<version>4</version>
|
||||
<fqname>IFingerprint/default</fqname>
|
||||
</hal>
|
||||
</manifest>
|
||||
|
||||
@@ -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,9 +17,10 @@ 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,7 +64,9 @@ 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>1</version>
|
||||
<version>4</version>
|
||||
<fqname>IHealth/default</fqname>
|
||||
</hal>
|
||||
</manifest>
|
||||
|
||||
@@ -17,7 +17,7 @@ cc_binary {
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"android.hardware.light-V1-ndk",
|
||||
"android.hardware.light-V2-ndk",
|
||||
],
|
||||
vendor: true,
|
||||
}
|
||||
|
||||
@@ -41,10 +41,12 @@ 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,
|
||||
@@ -147,7 +149,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) {
|
||||
@@ -168,7 +170,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));
|
||||
}
|
||||
@@ -179,11 +181,12 @@ 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,10 +9,11 @@
|
||||
#include <aidl/android/hardware/light/BnLights.h>
|
||||
#include <samsung_lights.h>
|
||||
|
||||
#include <functional>
|
||||
#include <unordered_map>
|
||||
|
||||
using ::aidl::android::hardware::light::HwLightState;
|
||||
using ::aidl::android::hardware::light::HwLight;
|
||||
using ::aidl::android::hardware::light::HwLightState;
|
||||
|
||||
namespace aidl {
|
||||
namespace android {
|
||||
@@ -20,13 +21,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);
|
||||
@@ -49,7 +50,7 @@ private:
|
||||
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
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.light</name>
|
||||
<version>2</version>
|
||||
<fqname>ILights/default</fqname>
|
||||
</hal>
|
||||
</manifest>
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
55
aidl/livedisplay/AdaptiveBacklight.cpp
Normal file
55
aidl/livedisplay/AdaptiveBacklight.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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
|
||||
65
aidl/livedisplay/Android.bp
Normal file
65
aidl/livedisplay/Android.bp
Normal file
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// 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,
|
||||
}
|
||||
76
aidl/livedisplay/DisplayColorCalibration.cpp
Normal file
76
aidl/livedisplay/DisplayColorCalibration.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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,48 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define LOG_TAG "DisplayModesService"
|
||||
|
||||
#include "DisplayModes.h"
|
||||
#include <android-base/logging.h>
|
||||
#include <livedisplay/samsung/DisplayModes.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace livedisplay {
|
||||
namespace V2_0 {
|
||||
namespace samsung {
|
||||
|
||||
static constexpr const char* kModePath = "/sys/class/mdnie/mdnie/mode";
|
||||
static constexpr const char* kModeMaxPath = "/sys/class/mdnie/mdnie/mode_max";
|
||||
#ifdef LIVES_IN_SYSTEM
|
||||
static constexpr const char* kDefaultPath = "/data/misc/display/.displaymodedefault";
|
||||
#else
|
||||
static constexpr const char* kDefaultPath = "/data/vendor/display/.displaymodedefault";
|
||||
#endif
|
||||
|
||||
const std::map<int32_t, std::string> DisplayModes::kModeMap = {
|
||||
// clang-format off
|
||||
// clang-format off
|
||||
{0, "Dynamic"},
|
||||
{1, "Standard"},
|
||||
{2, "Natural"},
|
||||
{3, "Cinema"},
|
||||
{4, "Adaptive"},
|
||||
{5, "Reading"},
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
DisplayModes::DisplayModes() : mDefaultModeId(0) {
|
||||
@@ -71,7 +57,7 @@ bool DisplayModes::isSupported() {
|
||||
}
|
||||
|
||||
// Methods from ::vendor::lineage::livedisplay::V2_0::IDisplayModes follow.
|
||||
Return<void> DisplayModes::getDisplayModes(getDisplayModes_cb resultCb) {
|
||||
ndk::ScopedAStatus DisplayModes::getDisplayModes(std::vector<DisplayMode>* _aidl_return) {
|
||||
std::ifstream maxModeFile(kModeMaxPath);
|
||||
int value;
|
||||
std::vector<DisplayMode> modes;
|
||||
@@ -83,11 +69,12 @@ Return<void> DisplayModes::getDisplayModes(getDisplayModes_cb resultCb) {
|
||||
for (const auto& entry : kModeMap) {
|
||||
if (entry.first < value) modes.push_back({entry.first, entry.second});
|
||||
}
|
||||
resultCb(modes);
|
||||
return Void();
|
||||
|
||||
*_aidl_return = modes;
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
Return<void> DisplayModes::getCurrentDisplayMode(getCurrentDisplayMode_cb resultCb) {
|
||||
ndk::ScopedAStatus DisplayModes::getCurrentDisplayMode(DisplayMode* _aidl_return) {
|
||||
int32_t currentModeId = mDefaultModeId;
|
||||
std::ifstream modeFile(kModePath);
|
||||
int value;
|
||||
@@ -100,41 +87,40 @@ Return<void> DisplayModes::getCurrentDisplayMode(getCurrentDisplayMode_cb result
|
||||
}
|
||||
}
|
||||
}
|
||||
resultCb({currentModeId, kModeMap.at(currentModeId)});
|
||||
return Void();
|
||||
|
||||
*_aidl_return = DisplayMode{currentModeId, kModeMap.at(currentModeId)};
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
Return<void> DisplayModes::getDefaultDisplayMode(getDefaultDisplayMode_cb resultCb) {
|
||||
resultCb({mDefaultModeId, kModeMap.at(mDefaultModeId)});
|
||||
return Void();
|
||||
ndk::ScopedAStatus DisplayModes::getDefaultDisplayMode(DisplayMode* _aidl_return) {
|
||||
*_aidl_return = DisplayMode{mDefaultModeId, kModeMap.at(mDefaultModeId)};
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
Return<bool> DisplayModes::setDisplayMode(int32_t modeID, bool makeDefault) {
|
||||
ndk::ScopedAStatus DisplayModes::setDisplayMode(int32_t modeID, bool makeDefault) {
|
||||
const auto iter = kModeMap.find(modeID);
|
||||
if (iter == kModeMap.end()) {
|
||||
return false;
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
std::ofstream modeFile(kModePath);
|
||||
modeFile << iter->first;
|
||||
if (modeFile.fail()) {
|
||||
return false;
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
|
||||
if (makeDefault) {
|
||||
std::ofstream defaultFile(kDefaultPath);
|
||||
defaultFile << iter->first;
|
||||
if (defaultFile.fail()) {
|
||||
return false;
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
mDefaultModeId = iter->first;
|
||||
}
|
||||
return true;
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||
|
||||
} // namespace samsung
|
||||
} // namespace V2_0
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
||||
55
aidl/livedisplay/ReadingEnhancementExynos.cpp
Normal file
55
aidl/livedisplay/ReadingEnhancementExynos.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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
|
||||
56
aidl/livedisplay/SunlightEnhancement.cpp
Normal file
56
aidl/livedisplay/SunlightEnhancement.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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
|
||||
56
aidl/livedisplay/SunlightEnhancementExynos.cpp
Normal file
56
aidl/livedisplay/SunlightEnhancementExynos.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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
|
||||
38
aidl/livedisplay/include/livedisplay/samsung/DisplayModes.h
Normal file
38
aidl/livedisplay/include/livedisplay/samsung/DisplayModes.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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
|
||||
111
aidl/livedisplay/service.cpp
Normal file
111
aidl/livedisplay/service.cpp
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
132
aidl/livedisplay/serviceExynos.cpp
Normal file
132
aidl/livedisplay/serviceExynos.cpp
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
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
|
||||
@@ -0,0 +1,7 @@
|
||||
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,11 +38,15 @@ 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,22 +18,26 @@ 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) {
|
||||
@@ -73,7 +77,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,16 +19,18 @@ 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);
|
||||
}
|
||||
@@ -45,8 +47,9 @@ 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) {
|
||||
@@ -56,8 +59,9 @@ 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;
|
||||
@@ -67,4 +71,4 @@ std::vector<directory_entry> directory_iterator(const path& p) {
|
||||
return out;
|
||||
}
|
||||
|
||||
} // namespace filesystem
|
||||
} // namespace filesystem
|
||||
|
||||
@@ -16,13 +16,12 @@
|
||||
|
||||
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();
|
||||
@@ -31,19 +30,17 @@ public:
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -57,4 +54,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
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.memtrack</name>
|
||||
<version>1</version>
|
||||
<fqname>IMemtrack/default</fqname>
|
||||
</hal>
|
||||
</manifest>
|
||||
|
||||
|
||||
24
aidl/powershare/Android.bp
Normal file
24
aidl/powershare/Android.bp
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// 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",
|
||||
],
|
||||
}
|
||||
69
aidl/powershare/PowerShare.cpp
Normal file
69
aidl/powershare/PowerShare.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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
|
||||
26
aidl/powershare/PowerShare.h
Normal file
26
aidl/powershare/PowerShare.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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
|
||||
12
aidl/powershare/samsung_powershare.h
Normal file
12
aidl/powershare/samsung_powershare.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* 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"
|
||||
25
aidl/powershare/service.cpp
Normal file
25
aidl/powershare/service.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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
|
||||
}
|
||||
10
aidl/powershare/vendor.lineage.powershare-service.samsung.rc
Normal file
10
aidl/powershare/vendor.lineage.powershare-service.samsung.rc
Normal file
@@ -0,0 +1,10 @@
|
||||
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 +1,7 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.thermal</name>
|
||||
<name>vendor.lineage.powershare</name>
|
||||
<version>1</version>
|
||||
<fqname>IThermal/default</fqname>
|
||||
<fqname>IPowerShare/default</fqname>
|
||||
</hal>
|
||||
</manifest>
|
||||
@@ -1,5 +1,6 @@
|
||||
//
|
||||
// Copyright (C) 2020 The Android Open Source Project
|
||||
// Copyright (C) 2022-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.
|
||||
@@ -15,27 +16,23 @@
|
||||
|
||||
cc_binary {
|
||||
name: "android.hardware.sensors-service.samsung-multihal",
|
||||
defaults: [
|
||||
"hidl_defaults",
|
||||
],
|
||||
vendor: true,
|
||||
relative_install_path: "hw",
|
||||
srcs: [
|
||||
"ConvertUtils.cpp",
|
||||
"HalProxyAidl.cpp",
|
||||
"HalProxySamsung.cpp",
|
||||
"service.cpp",
|
||||
],
|
||||
local_include_dirs: ["include"],
|
||||
init_rc: ["android.hardware.sensors-service.samsung-multihal.rc"],
|
||||
vintf_fragments: ["android.hardware.sensors-samsung-multihal.xml"],
|
||||
header_libs: [
|
||||
"android.hardware.sensors@2.X-multihal.header",
|
||||
"android.hardware.sensors@2.X-shared-utils",
|
||||
],
|
||||
shared_libs: [
|
||||
"android.hardware.sensors@2.0",
|
||||
"android.hardware.sensors@2.0-ScopedWakelock",
|
||||
"android.hardware.sensors@2.1",
|
||||
"android.hardware.sensors-V1-ndk",
|
||||
"android.hardware.sensors-V3-ndk",
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"libcutils",
|
||||
@@ -48,6 +45,13 @@ cc_binary {
|
||||
static_libs: [
|
||||
"android.hardware.sensors@1.0-convert",
|
||||
"android.hardware.sensors@2.X-multihal",
|
||||
"android.hardware.sensors@aidl-multihal",
|
||||
"libaidlcommonsupport",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "sensors.sensorhub_wait_for_mcu",
|
||||
srcs: ["SensorHubWaitForMCUInit.cpp"],
|
||||
vendor: true,
|
||||
}
|
||||
|
||||
@@ -1,363 +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.
|
||||
*/
|
||||
|
||||
#include "ConvertUtils.h"
|
||||
#include <android-base/logging.h>
|
||||
#include <log/log.h>
|
||||
|
||||
using AidlSensorInfo = ::aidl::android::hardware::sensors::SensorInfo;
|
||||
using AidlSensorType = ::aidl::android::hardware::sensors::SensorType;
|
||||
using AidlEvent = ::aidl::android::hardware::sensors::Event;
|
||||
using AidlSensorStatus = ::aidl::android::hardware::sensors::SensorStatus;
|
||||
using ::aidl::android::hardware::sensors::AdditionalInfo;
|
||||
using ::aidl::android::hardware::sensors::DynamicSensorInfo;
|
||||
using ::android::hardware::sensors::V1_0::MetaDataEventType;
|
||||
using V1_0SensorStatus = ::android::hardware::sensors::V1_0::SensorStatus;
|
||||
using ::android::hardware::sensors::V1_0::AdditionalInfoType;
|
||||
using V2_1SensorInfo = ::android::hardware::sensors::V2_1::SensorInfo;
|
||||
using V2_1Event = ::android::hardware::sensors::V2_1::Event;
|
||||
using V2_1SensorType = ::android::hardware::sensors::V2_1::SensorType;
|
||||
|
||||
namespace aidl {
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace sensors {
|
||||
namespace implementation {
|
||||
|
||||
AidlSensorInfo convertSensorInfo(const V2_1SensorInfo& sensorInfo) {
|
||||
AidlSensorInfo aidlSensorInfo;
|
||||
aidlSensorInfo.sensorHandle = sensorInfo.sensorHandle;
|
||||
aidlSensorInfo.name = sensorInfo.name;
|
||||
aidlSensorInfo.vendor = sensorInfo.vendor;
|
||||
aidlSensorInfo.version = sensorInfo.version;
|
||||
aidlSensorInfo.type = (AidlSensorType)sensorInfo.type;
|
||||
aidlSensorInfo.typeAsString = sensorInfo.typeAsString;
|
||||
aidlSensorInfo.maxRange = sensorInfo.maxRange;
|
||||
aidlSensorInfo.resolution = sensorInfo.resolution;
|
||||
aidlSensorInfo.power = sensorInfo.power;
|
||||
aidlSensorInfo.minDelayUs = sensorInfo.minDelay;
|
||||
aidlSensorInfo.fifoReservedEventCount = sensorInfo.fifoReservedEventCount;
|
||||
aidlSensorInfo.fifoMaxEventCount = sensorInfo.fifoMaxEventCount;
|
||||
aidlSensorInfo.requiredPermission = sensorInfo.requiredPermission;
|
||||
aidlSensorInfo.maxDelayUs = sensorInfo.maxDelay;
|
||||
aidlSensorInfo.flags = sensorInfo.flags;
|
||||
return aidlSensorInfo;
|
||||
}
|
||||
|
||||
void convertToHidlEvent(const AidlEvent& aidlEvent, V2_1Event* hidlEvent) {
|
||||
static_assert(decltype(hidlEvent->u.data)::elementCount() == 16);
|
||||
hidlEvent->timestamp = aidlEvent.timestamp;
|
||||
hidlEvent->sensorHandle = aidlEvent.sensorHandle;
|
||||
hidlEvent->sensorType = (V2_1SensorType)aidlEvent.sensorType;
|
||||
|
||||
switch (aidlEvent.sensorType) {
|
||||
case AidlSensorType::META_DATA:
|
||||
hidlEvent->u.meta.what =
|
||||
(MetaDataEventType)aidlEvent.payload.get<Event::EventPayload::meta>().what;
|
||||
break;
|
||||
case AidlSensorType::ACCELEROMETER:
|
||||
case AidlSensorType::MAGNETIC_FIELD:
|
||||
case AidlSensorType::ORIENTATION:
|
||||
case AidlSensorType::GYROSCOPE:
|
||||
case AidlSensorType::GRAVITY:
|
||||
case AidlSensorType::LINEAR_ACCELERATION:
|
||||
hidlEvent->u.vec3.x = aidlEvent.payload.get<Event::EventPayload::vec3>().x;
|
||||
hidlEvent->u.vec3.y = aidlEvent.payload.get<Event::EventPayload::vec3>().y;
|
||||
hidlEvent->u.vec3.z = aidlEvent.payload.get<Event::EventPayload::vec3>().z;
|
||||
hidlEvent->u.vec3.status =
|
||||
(V1_0SensorStatus)aidlEvent.payload.get<Event::EventPayload::vec3>().status;
|
||||
break;
|
||||
case AidlSensorType::GAME_ROTATION_VECTOR:
|
||||
hidlEvent->u.vec4.x = aidlEvent.payload.get<Event::EventPayload::vec4>().x;
|
||||
hidlEvent->u.vec4.y = aidlEvent.payload.get<Event::EventPayload::vec4>().y;
|
||||
hidlEvent->u.vec4.z = aidlEvent.payload.get<Event::EventPayload::vec4>().z;
|
||||
hidlEvent->u.vec4.w = aidlEvent.payload.get<Event::EventPayload::vec4>().w;
|
||||
break;
|
||||
case AidlSensorType::ROTATION_VECTOR:
|
||||
case AidlSensorType::GEOMAGNETIC_ROTATION_VECTOR:
|
||||
std::copy(aidlEvent.payload.get<Event::EventPayload::data>().values.data(),
|
||||
aidlEvent.payload.get<Event::EventPayload::data>().values.data() + 5,
|
||||
hidlEvent->u.data.data());
|
||||
break;
|
||||
case AidlSensorType::ACCELEROMETER_UNCALIBRATED:
|
||||
case AidlSensorType::MAGNETIC_FIELD_UNCALIBRATED:
|
||||
case AidlSensorType::GYROSCOPE_UNCALIBRATED:
|
||||
hidlEvent->u.uncal.x = aidlEvent.payload.get<Event::EventPayload::uncal>().x;
|
||||
hidlEvent->u.uncal.y = aidlEvent.payload.get<Event::EventPayload::uncal>().y;
|
||||
hidlEvent->u.uncal.z = aidlEvent.payload.get<Event::EventPayload::uncal>().z;
|
||||
hidlEvent->u.uncal.x_bias = aidlEvent.payload.get<Event::EventPayload::uncal>().xBias;
|
||||
hidlEvent->u.uncal.y_bias = aidlEvent.payload.get<Event::EventPayload::uncal>().yBias;
|
||||
hidlEvent->u.uncal.z_bias = aidlEvent.payload.get<Event::EventPayload::uncal>().zBias;
|
||||
break;
|
||||
case AidlSensorType::DEVICE_ORIENTATION:
|
||||
case AidlSensorType::LIGHT:
|
||||
case AidlSensorType::PRESSURE:
|
||||
case AidlSensorType::PROXIMITY:
|
||||
case AidlSensorType::RELATIVE_HUMIDITY:
|
||||
case AidlSensorType::AMBIENT_TEMPERATURE:
|
||||
case AidlSensorType::SIGNIFICANT_MOTION:
|
||||
case AidlSensorType::STEP_DETECTOR:
|
||||
case AidlSensorType::TILT_DETECTOR:
|
||||
case AidlSensorType::WAKE_GESTURE:
|
||||
case AidlSensorType::GLANCE_GESTURE:
|
||||
case AidlSensorType::PICK_UP_GESTURE:
|
||||
case AidlSensorType::WRIST_TILT_GESTURE:
|
||||
case AidlSensorType::STATIONARY_DETECT:
|
||||
case AidlSensorType::MOTION_DETECT:
|
||||
case AidlSensorType::HEART_BEAT:
|
||||
case AidlSensorType::LOW_LATENCY_OFFBODY_DETECT:
|
||||
case AidlSensorType::HINGE_ANGLE:
|
||||
hidlEvent->u.scalar = aidlEvent.payload.get<Event::EventPayload::scalar>();
|
||||
break;
|
||||
case AidlSensorType::STEP_COUNTER:
|
||||
hidlEvent->u.stepCount = aidlEvent.payload.get<AidlEvent::EventPayload::stepCount>();
|
||||
break;
|
||||
case AidlSensorType::HEART_RATE:
|
||||
hidlEvent->u.heartRate.bpm =
|
||||
aidlEvent.payload.get<AidlEvent::EventPayload::heartRate>().bpm;
|
||||
hidlEvent->u.heartRate.status =
|
||||
(V1_0SensorStatus)aidlEvent.payload.get<Event::EventPayload::heartRate>()
|
||||
.status;
|
||||
break;
|
||||
case AidlSensorType::POSE_6DOF:
|
||||
std::copy(std::begin(aidlEvent.payload.get<AidlEvent::EventPayload::pose6DOF>().values),
|
||||
std::end(aidlEvent.payload.get<AidlEvent::EventPayload::pose6DOF>().values),
|
||||
hidlEvent->u.pose6DOF.data());
|
||||
break;
|
||||
case AidlSensorType::DYNAMIC_SENSOR_META:
|
||||
hidlEvent->u.dynamic.connected =
|
||||
aidlEvent.payload.get<Event::EventPayload::dynamic>().connected;
|
||||
hidlEvent->u.dynamic.sensorHandle =
|
||||
aidlEvent.payload.get<Event::EventPayload::dynamic>().sensorHandle;
|
||||
std::copy(
|
||||
std::begin(
|
||||
aidlEvent.payload.get<AidlEvent::EventPayload::dynamic>().uuid.values),
|
||||
std::end(aidlEvent.payload.get<AidlEvent::EventPayload::dynamic>().uuid.values),
|
||||
hidlEvent->u.dynamic.uuid.data());
|
||||
break;
|
||||
case AidlSensorType::ADDITIONAL_INFO: {
|
||||
const AdditionalInfo& additionalInfo =
|
||||
aidlEvent.payload.get<AidlEvent::EventPayload::additional>();
|
||||
hidlEvent->u.additional.type = (AdditionalInfoType)additionalInfo.type;
|
||||
hidlEvent->u.additional.serial = additionalInfo.serial;
|
||||
|
||||
switch (additionalInfo.payload.getTag()) {
|
||||
case AdditionalInfo::AdditionalInfoPayload::Tag::dataInt32: {
|
||||
const auto& aidlData =
|
||||
additionalInfo.payload
|
||||
.get<AdditionalInfo::AdditionalInfoPayload::dataInt32>()
|
||||
.values;
|
||||
std::copy(std::begin(aidlData), std::end(aidlData),
|
||||
hidlEvent->u.additional.u.data_int32.data());
|
||||
break;
|
||||
}
|
||||
case AdditionalInfo::AdditionalInfoPayload::Tag::dataFloat: {
|
||||
const auto& aidlData =
|
||||
additionalInfo.payload
|
||||
.get<AdditionalInfo::AdditionalInfoPayload::dataFloat>()
|
||||
.values;
|
||||
std::copy(std::begin(aidlData), std::end(aidlData),
|
||||
hidlEvent->u.additional.u.data_float.data());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ALOGE("Invalid sensor additioanl info tag: %d",
|
||||
static_cast<int32_t>(additionalInfo.payload.getTag()));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AidlSensorType::HEAD_TRACKER: {
|
||||
const auto& ht = aidlEvent.payload.get<Event::EventPayload::headTracker>();
|
||||
hidlEvent->u.data[0] = ht.rx;
|
||||
hidlEvent->u.data[1] = ht.ry;
|
||||
hidlEvent->u.data[2] = ht.rz;
|
||||
hidlEvent->u.data[3] = ht.vx;
|
||||
hidlEvent->u.data[4] = ht.vy;
|
||||
hidlEvent->u.data[5] = ht.vz;
|
||||
|
||||
// IMPORTANT: Because we want to preserve the data range of discontinuityCount,
|
||||
// we assume the data can be interpreted as an int32_t directly (e.g. the underlying
|
||||
// HIDL HAL must be using memcpy or equivalent to store this value).
|
||||
*(reinterpret_cast<int32_t*>(&hidlEvent->u.data[6])) = ht.discontinuityCount;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
CHECK_GE((int32_t)aidlEvent.sensorType, (int32_t)SensorType::DEVICE_PRIVATE_BASE);
|
||||
std::copy(std::begin(aidlEvent.payload.get<AidlEvent::EventPayload::data>().values),
|
||||
std::end(aidlEvent.payload.get<AidlEvent::EventPayload::data>().values),
|
||||
hidlEvent->u.data.data());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void convertToAidlEvent(const V2_1Event& hidlEvent, AidlEvent* aidlEvent) {
|
||||
static_assert(decltype(hidlEvent.u.data)::elementCount() == 16);
|
||||
aidlEvent->timestamp = hidlEvent.timestamp;
|
||||
aidlEvent->sensorHandle = hidlEvent.sensorHandle;
|
||||
aidlEvent->sensorType = (AidlSensorType)hidlEvent.sensorType;
|
||||
switch (hidlEvent.sensorType) {
|
||||
case V2_1SensorType::META_DATA: {
|
||||
AidlEvent::EventPayload::MetaData meta;
|
||||
meta.what = (Event::EventPayload::MetaData::MetaDataEventType)hidlEvent.u.meta.what;
|
||||
aidlEvent->payload.set<Event::EventPayload::meta>(meta);
|
||||
break;
|
||||
}
|
||||
case V2_1SensorType::ACCELEROMETER:
|
||||
case V2_1SensorType::MAGNETIC_FIELD:
|
||||
case V2_1SensorType::ORIENTATION:
|
||||
case V2_1SensorType::GYROSCOPE:
|
||||
case V2_1SensorType::GRAVITY:
|
||||
case V2_1SensorType::LINEAR_ACCELERATION: {
|
||||
AidlEvent::EventPayload::Vec3 vec3;
|
||||
vec3.x = hidlEvent.u.vec3.x;
|
||||
vec3.y = hidlEvent.u.vec3.y;
|
||||
vec3.z = hidlEvent.u.vec3.z;
|
||||
vec3.status = (SensorStatus)hidlEvent.u.vec3.status;
|
||||
aidlEvent->payload.set<Event::EventPayload::vec3>(vec3);
|
||||
break;
|
||||
}
|
||||
case V2_1SensorType::GAME_ROTATION_VECTOR: {
|
||||
AidlEvent::EventPayload::Vec4 vec4;
|
||||
vec4.x = hidlEvent.u.vec4.x;
|
||||
vec4.y = hidlEvent.u.vec4.y;
|
||||
vec4.z = hidlEvent.u.vec4.z;
|
||||
vec4.w = hidlEvent.u.vec4.w;
|
||||
aidlEvent->payload.set<Event::EventPayload::vec4>(vec4);
|
||||
break;
|
||||
}
|
||||
case V2_1SensorType::ROTATION_VECTOR:
|
||||
case V2_1SensorType::GEOMAGNETIC_ROTATION_VECTOR: {
|
||||
AidlEvent::EventPayload::Data data;
|
||||
std::copy(hidlEvent.u.data.data(), hidlEvent.u.data.data() + 5,
|
||||
std::begin(data.values));
|
||||
aidlEvent->payload.set<Event::EventPayload::data>(data);
|
||||
break;
|
||||
}
|
||||
case V2_1SensorType::MAGNETIC_FIELD_UNCALIBRATED:
|
||||
case V2_1SensorType::GYROSCOPE_UNCALIBRATED:
|
||||
case V2_1SensorType::ACCELEROMETER_UNCALIBRATED: {
|
||||
AidlEvent::EventPayload::Uncal uncal;
|
||||
uncal.x = hidlEvent.u.uncal.x;
|
||||
uncal.y = hidlEvent.u.uncal.y;
|
||||
uncal.z = hidlEvent.u.uncal.z;
|
||||
uncal.xBias = hidlEvent.u.uncal.x_bias;
|
||||
uncal.yBias = hidlEvent.u.uncal.y_bias;
|
||||
uncal.zBias = hidlEvent.u.uncal.z_bias;
|
||||
aidlEvent->payload.set<Event::EventPayload::uncal>(uncal);
|
||||
break;
|
||||
}
|
||||
case V2_1SensorType::DEVICE_ORIENTATION:
|
||||
case V2_1SensorType::LIGHT:
|
||||
case V2_1SensorType::PRESSURE:
|
||||
case V2_1SensorType::PROXIMITY:
|
||||
case V2_1SensorType::RELATIVE_HUMIDITY:
|
||||
case V2_1SensorType::AMBIENT_TEMPERATURE:
|
||||
case V2_1SensorType::SIGNIFICANT_MOTION:
|
||||
case V2_1SensorType::STEP_DETECTOR:
|
||||
case V2_1SensorType::TILT_DETECTOR:
|
||||
case V2_1SensorType::WAKE_GESTURE:
|
||||
case V2_1SensorType::GLANCE_GESTURE:
|
||||
case V2_1SensorType::PICK_UP_GESTURE:
|
||||
case V2_1SensorType::WRIST_TILT_GESTURE:
|
||||
case V2_1SensorType::STATIONARY_DETECT:
|
||||
case V2_1SensorType::MOTION_DETECT:
|
||||
case V2_1SensorType::HEART_BEAT:
|
||||
case V2_1SensorType::LOW_LATENCY_OFFBODY_DETECT:
|
||||
case V2_1SensorType::HINGE_ANGLE:
|
||||
aidlEvent->payload.set<Event::EventPayload::scalar>(hidlEvent.u.scalar);
|
||||
break;
|
||||
case V2_1SensorType::STEP_COUNTER:
|
||||
aidlEvent->payload.set<Event::EventPayload::stepCount>(hidlEvent.u.stepCount);
|
||||
break;
|
||||
case V2_1SensorType::HEART_RATE: {
|
||||
AidlEvent::EventPayload::HeartRate heartRate;
|
||||
heartRate.bpm = hidlEvent.u.heartRate.bpm;
|
||||
heartRate.status = (SensorStatus)hidlEvent.u.heartRate.status;
|
||||
aidlEvent->payload.set<Event::EventPayload::heartRate>(heartRate);
|
||||
break;
|
||||
}
|
||||
case V2_1SensorType::POSE_6DOF: {
|
||||
AidlEvent::EventPayload::Pose6Dof pose6Dof;
|
||||
std::copy(hidlEvent.u.pose6DOF.data(),
|
||||
hidlEvent.u.pose6DOF.data() + hidlEvent.u.pose6DOF.size(),
|
||||
std::begin(pose6Dof.values));
|
||||
aidlEvent->payload.set<Event::EventPayload::pose6DOF>(pose6Dof);
|
||||
break;
|
||||
}
|
||||
case V2_1SensorType::DYNAMIC_SENSOR_META: {
|
||||
DynamicSensorInfo dynamicSensorInfo;
|
||||
dynamicSensorInfo.connected = hidlEvent.u.dynamic.connected;
|
||||
dynamicSensorInfo.sensorHandle = hidlEvent.u.dynamic.sensorHandle;
|
||||
std::copy(hidlEvent.u.dynamic.uuid.data(),
|
||||
hidlEvent.u.dynamic.uuid.data() + hidlEvent.u.dynamic.uuid.size(),
|
||||
std::begin(dynamicSensorInfo.uuid.values));
|
||||
aidlEvent->payload.set<Event::EventPayload::dynamic>(dynamicSensorInfo);
|
||||
break;
|
||||
}
|
||||
case V2_1SensorType::ADDITIONAL_INFO: {
|
||||
AdditionalInfo additionalInfo;
|
||||
additionalInfo.type = (AdditionalInfo::AdditionalInfoType)hidlEvent.u.additional.type;
|
||||
additionalInfo.serial = hidlEvent.u.additional.serial;
|
||||
|
||||
AdditionalInfo::AdditionalInfoPayload::Int32Values int32Values;
|
||||
std::copy(hidlEvent.u.additional.u.data_int32.data(),
|
||||
hidlEvent.u.additional.u.data_int32.data() +
|
||||
hidlEvent.u.additional.u.data_int32.size(),
|
||||
std::begin(int32Values.values));
|
||||
additionalInfo.payload.set<AdditionalInfo::AdditionalInfoPayload::dataInt32>(
|
||||
int32Values);
|
||||
aidlEvent->payload.set<Event::EventPayload::additional>(additionalInfo);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if (static_cast<int32_t>(hidlEvent.sensorType) ==
|
||||
static_cast<int32_t>(AidlSensorType::HEAD_TRACKER)) {
|
||||
Event::EventPayload::HeadTracker headTracker;
|
||||
headTracker.rx = hidlEvent.u.data[0];
|
||||
headTracker.ry = hidlEvent.u.data[1];
|
||||
headTracker.rz = hidlEvent.u.data[2];
|
||||
headTracker.vx = hidlEvent.u.data[3];
|
||||
headTracker.vy = hidlEvent.u.data[4];
|
||||
headTracker.vz = hidlEvent.u.data[5];
|
||||
|
||||
// IMPORTANT: Because we want to preserve the data range of discontinuityCount,
|
||||
// we assume the data can be interpreted as an int32_t directly (e.g. the underlying
|
||||
// HIDL HAL must be using memcpy or equivalent to store this value).
|
||||
headTracker.discontinuityCount =
|
||||
*(reinterpret_cast<const int32_t*>(&hidlEvent.u.data[6]));
|
||||
|
||||
aidlEvent->payload.set<Event::EventPayload::Tag::headTracker>(headTracker);
|
||||
} else {
|
||||
CHECK_GE((int32_t)hidlEvent.sensorType,
|
||||
(int32_t)V2_1SensorType::DEVICE_PRIVATE_BASE);
|
||||
AidlEvent::EventPayload::Data data;
|
||||
std::copy(hidlEvent.u.data.data(),
|
||||
hidlEvent.u.data.data() + hidlEvent.u.data.size(),
|
||||
std::begin(data.values));
|
||||
aidlEvent->payload.set<Event::EventPayload::data>(data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace sensors
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // namespace aidl
|
||||
@@ -1,269 +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.
|
||||
*/
|
||||
|
||||
//#define VERBOSE
|
||||
|
||||
#include "HalProxyAidl.h"
|
||||
#include <aidlcommonsupport/NativeHandle.h>
|
||||
#include <fmq/AidlMessageQueue.h>
|
||||
#include <hidl/Status.h>
|
||||
#include "ConvertUtils.h"
|
||||
#include "EventMessageQueueWrapperAidl.h"
|
||||
#include "ISensorsCallbackWrapperAidl.h"
|
||||
#include "WakeLockMessageQueueWrapperAidl.h"
|
||||
#include "convertV2_1.h"
|
||||
|
||||
using ::aidl::android::hardware::common::fmq::MQDescriptor;
|
||||
using ::aidl::android::hardware::common::fmq::SynchronizedReadWrite;
|
||||
using ::aidl::android::hardware::sensors::ISensors;
|
||||
using ::aidl::android::hardware::sensors::ISensorsCallback;
|
||||
using ::aidl::android::hardware::sensors::SensorInfo;
|
||||
using ::android::hardware::sensors::V2_1::implementation::convertToOldEvent;
|
||||
using ::ndk::ScopedAStatus;
|
||||
|
||||
namespace aidl {
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace sensors {
|
||||
namespace implementation {
|
||||
|
||||
static ScopedAStatus
|
||||
resultToAStatus(::android::hardware::sensors::V1_0::Result result) {
|
||||
switch (result) {
|
||||
case ::android::hardware::sensors::V1_0::Result::OK:
|
||||
return ScopedAStatus::ok();
|
||||
case ::android::hardware::sensors::V1_0::Result::PERMISSION_DENIED:
|
||||
return ScopedAStatus::fromExceptionCode(EX_SECURITY);
|
||||
case ::android::hardware::sensors::V1_0::Result::NO_MEMORY:
|
||||
return ScopedAStatus::fromServiceSpecificError(ISensors::ERROR_NO_MEMORY);
|
||||
case ::android::hardware::sensors::V1_0::Result::BAD_VALUE:
|
||||
return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||
case ::android::hardware::sensors::V1_0::Result::INVALID_OPERATION:
|
||||
return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
default:
|
||||
return ScopedAStatus::fromExceptionCode(EX_TRANSACTION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
static ::android::hardware::sensors::V1_0::RateLevel convertRateLevel(
|
||||
ISensors::RateLevel rateLevel) {
|
||||
switch (rateLevel) {
|
||||
case ISensors::RateLevel::STOP:
|
||||
return ::android::hardware::sensors::V1_0::RateLevel::STOP;
|
||||
case ISensors::RateLevel::NORMAL:
|
||||
return ::android::hardware::sensors::V1_0::RateLevel::NORMAL;
|
||||
case ISensors::RateLevel::FAST:
|
||||
return ::android::hardware::sensors::V1_0::RateLevel::FAST;
|
||||
case ISensors::RateLevel::VERY_FAST:
|
||||
return ::android::hardware::sensors::V1_0::RateLevel::VERY_FAST;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
static ::android::hardware::sensors::V1_0::OperationMode convertOperationMode(
|
||||
ISensors::OperationMode operationMode) {
|
||||
switch (operationMode) {
|
||||
case ISensors::OperationMode::NORMAL:
|
||||
return ::android::hardware::sensors::V1_0::OperationMode::NORMAL;
|
||||
case ISensors::OperationMode::DATA_INJECTION:
|
||||
return ::android::hardware::sensors::V1_0::OperationMode::DATA_INJECTION;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
static ::android::hardware::sensors::V1_0::SharedMemType convertSharedMemType(
|
||||
ISensors::SharedMemInfo::SharedMemType sharedMemType) {
|
||||
switch (sharedMemType) {
|
||||
case ISensors::SharedMemInfo::SharedMemType::ASHMEM:
|
||||
return ::android::hardware::sensors::V1_0::SharedMemType::ASHMEM;
|
||||
case ISensors::SharedMemInfo::SharedMemType::GRALLOC:
|
||||
return ::android::hardware::sensors::V1_0::SharedMemType::GRALLOC;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
static ::android::hardware::sensors::V1_0::SharedMemFormat convertSharedMemFormat(
|
||||
ISensors::SharedMemInfo::SharedMemFormat sharedMemFormat) {
|
||||
switch (sharedMemFormat) {
|
||||
case ISensors::SharedMemInfo::SharedMemFormat::SENSORS_EVENT:
|
||||
return ::android::hardware::sensors::V1_0::SharedMemFormat::SENSORS_EVENT;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
static ::android::hardware::sensors::V1_0::SharedMemInfo convertSharedMemInfo(
|
||||
const ISensors::SharedMemInfo& sharedMemInfo) {
|
||||
::android::hardware::sensors::V1_0::SharedMemInfo v1SharedMemInfo;
|
||||
v1SharedMemInfo.type = convertSharedMemType(sharedMemInfo.type);
|
||||
v1SharedMemInfo.format = convertSharedMemFormat(sharedMemInfo.format);
|
||||
v1SharedMemInfo.size = sharedMemInfo.size;
|
||||
v1SharedMemInfo.memoryHandle =
|
||||
::android::hardware::hidl_handle(::android::makeFromAidl(sharedMemInfo.memoryHandle));
|
||||
return v1SharedMemInfo;
|
||||
}
|
||||
|
||||
ScopedAStatus HalProxyAidl::activate(int32_t in_sensorHandle, bool in_enabled) {
|
||||
return resultToAStatus(HalProxy::activate(in_sensorHandle, in_enabled));
|
||||
}
|
||||
|
||||
ScopedAStatus HalProxyAidl::batch(int32_t in_sensorHandle,
|
||||
int64_t in_samplingPeriodNs,
|
||||
int64_t in_maxReportLatencyNs) {
|
||||
return resultToAStatus(HalProxy::batch(in_sensorHandle, in_samplingPeriodNs,
|
||||
in_maxReportLatencyNs));
|
||||
}
|
||||
|
||||
ScopedAStatus HalProxyAidl::configDirectReport(int32_t in_sensorHandle,
|
||||
int32_t in_channelHandle,
|
||||
ISensors::RateLevel in_rate,
|
||||
int32_t *_aidl_return) {
|
||||
ScopedAStatus status =
|
||||
ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
HalProxy::configDirectReport(
|
||||
in_sensorHandle, in_channelHandle, convertRateLevel(in_rate),
|
||||
[&status, _aidl_return](::android::hardware::sensors::V1_0::Result result,
|
||||
int32_t reportToken) {
|
||||
status = resultToAStatus(result);
|
||||
*_aidl_return = reportToken;
|
||||
});
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
ScopedAStatus HalProxyAidl::flush(int32_t in_sensorHandle) {
|
||||
return resultToAStatus(HalProxy::flush(in_sensorHandle));
|
||||
}
|
||||
|
||||
|
||||
ScopedAStatus HalProxyAidl::getSensorsList(
|
||||
std::vector<::aidl::android::hardware::sensors::SensorInfo> *_aidl_return) {
|
||||
for (const auto &sensor : HalProxy::getSensors()) {
|
||||
SensorInfo dst = sensor.second;
|
||||
|
||||
if (dst.requiredPermission == "com.samsung.permission.SSENSOR") {
|
||||
dst.requiredPermission = "";
|
||||
}
|
||||
|
||||
if (dst.typeAsString == "com.samsung.sensor.physical_proximity" ||
|
||||
dst.typeAsString == "com.samsung.sensor.hover_proximity") {
|
||||
ALOGI("Fixing %s", dst.typeAsString.c_str());
|
||||
dst.type = ::android::hardware::sensors::V2_1::SensorType::PROXIMITY;
|
||||
dst.typeAsString = SENSOR_STRING_TYPE_PROXIMITY;
|
||||
dst.maxRange = 1;
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
ALOGI( "SENSOR NAME:%s ", dst.name.c_str());
|
||||
ALOGI( " VENDOR:%s ", dst.name.c_str());
|
||||
ALOGI( " TYPE:%d ", (uint32_t)dst.type);
|
||||
ALOGI( " TYPE_AS_STRING:%s ", dst.typeAsString.c_str());
|
||||
#endif
|
||||
|
||||
_aidl_return->push_back(convertSensorInfo(dst));
|
||||
}
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HalProxyAidl::initialize(
|
||||
const MQDescriptor<::aidl::android::hardware::sensors::Event,
|
||||
SynchronizedReadWrite> &in_eventQueueDescriptor,
|
||||
const MQDescriptor<int32_t, SynchronizedReadWrite> &in_wakeLockDescriptor,
|
||||
const std::shared_ptr<ISensorsCallback> &in_sensorsCallback) {
|
||||
::android::sp<::android::hardware::sensors::V2_1::implementation::
|
||||
ISensorsCallbackWrapperBase>
|
||||
dynamicCallback = new ISensorsCallbackWrapperAidl(in_sensorsCallback);
|
||||
|
||||
auto aidlEventQueue = std::make_unique<::android::AidlMessageQueue<
|
||||
::aidl::android::hardware::sensors::Event, SynchronizedReadWrite>>(
|
||||
in_eventQueueDescriptor, true /* resetPointers */);
|
||||
std::unique_ptr<::android::hardware::sensors::V2_1::implementation::
|
||||
EventMessageQueueWrapperBase>
|
||||
eventQueue =
|
||||
std::make_unique<EventMessageQueueWrapperAidl>(aidlEventQueue);
|
||||
|
||||
auto aidlWakeLockQueue = std::make_unique<
|
||||
::android::AidlMessageQueue<int32_t, SynchronizedReadWrite>>(
|
||||
in_wakeLockDescriptor, true /* resetPointers */);
|
||||
std::unique_ptr<::android::hardware::sensors::V2_1::implementation::
|
||||
WakeLockMessageQueueWrapperBase>
|
||||
wakeLockQueue =
|
||||
std::make_unique<WakeLockMessageQueueWrapperAidl>(aidlWakeLockQueue);
|
||||
|
||||
return resultToAStatus(
|
||||
initializeCommon(eventQueue, wakeLockQueue, dynamicCallback));
|
||||
}
|
||||
|
||||
ScopedAStatus HalProxyAidl::injectSensorData(
|
||||
const ::aidl::android::hardware::sensors::Event &in_event) {
|
||||
::android::hardware::sensors::V2_1::Event hidlEvent;
|
||||
convertToHidlEvent(in_event, &hidlEvent);
|
||||
return resultToAStatus(
|
||||
HalProxy::injectSensorData(convertToOldEvent(hidlEvent)));
|
||||
}
|
||||
|
||||
ScopedAStatus
|
||||
HalProxyAidl::registerDirectChannel(const ISensors::SharedMemInfo &in_mem,
|
||||
int32_t *_aidl_return) {
|
||||
ScopedAStatus status =
|
||||
ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
::android::hardware::sensors::V1_0::SharedMemInfo sharedMemInfo =
|
||||
convertSharedMemInfo(in_mem);
|
||||
|
||||
HalProxy::registerDirectChannel(
|
||||
sharedMemInfo,
|
||||
[&status, _aidl_return](::android::hardware::sensors::V1_0::Result result,
|
||||
int32_t reportToken) {
|
||||
status = resultToAStatus(result);
|
||||
*_aidl_return = reportToken;
|
||||
});
|
||||
|
||||
native_handle_delete(const_cast<native_handle_t *>(
|
||||
sharedMemInfo.memoryHandle.getNativeHandle()));
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
ScopedAStatus HalProxyAidl::setOperationMode(
|
||||
::aidl::android::hardware::sensors::ISensors::OperationMode in_mode) {
|
||||
return resultToAStatus(
|
||||
HalProxy::setOperationMode(convertOperationMode(in_mode)));
|
||||
}
|
||||
|
||||
ScopedAStatus HalProxyAidl::unregisterDirectChannel(int32_t in_channelHandle) {
|
||||
return resultToAStatus(HalProxy::unregisterDirectChannel(in_channelHandle));
|
||||
}
|
||||
|
||||
binder_status_t HalProxyAidl::dump(int fd, const char ** /* args */,
|
||||
uint32_t /* numArgs */) {
|
||||
native_handle_t *nativeHandle =
|
||||
native_handle_create(1 /* numFds */, 0 /* numInts */);
|
||||
nativeHandle->data[0] = fd;
|
||||
|
||||
HalProxy::debug(nativeHandle, {} /* args */);
|
||||
|
||||
native_handle_delete(nativeHandle);
|
||||
return STATUS_OK;
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace sensors
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
} // 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