euicc: fix all lint findings
- Commit
2a3ca9c862073c4cdee22f736fab80559f84e35a- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-17 05:04 UTC (19 days ago)
- Parents
8c9515a
Fix every lint warning reported for the euicc module's own sources by :euicc:lintDev, now 0 errors / 0 warnings for euicc/** (remaining report entries are transitive library findings owned by other clusters).
NewApi (3): EuiccChannelManager gates the API 33 port APIs behind Build.VERSION.SDK_INT >= TIRAMISU with an API 31-32 fallback (deprecated slotIndex under a Kotlin-level @Suppress("DEPRECATION"), implicit port 0). Manifest: added POST_NOTIFICATIONS, declared the esimsetup intent-filter autoVerify="false" (an unpinned provisioning handoff, not a verified app link), and added the optional telephony uses-feature. UnusedResources: deleted add_new_carrier, no_euicc and eid_title from the default and Estonian locales after verifying the UI uses other strings.
Justified suppressions: tools:ignore ProtectedPermissions on MODIFY_PHONE_STATE, WRITE_EMBEDDED_SUBSCRIPTIONS and READ_PRIVILEGED_PHONE_STATE — privileged LPA permissions only ever granted to the platform-signed local profile assistant, inert when sideloaded; the manifest says so. No lint config or baseline changed.
Verified: ./gradlew :euicc:lintDev (0 own-module errors/warnings) and :euicc:testDevUnitTest green.Diff
euicc/src/main/AndroidManifest.xml
diff --git a/euicc/src/main/AndroidManifest.xml b/euicc/src/main/AndroidManifest.xmlindex 5709e0a3ab..e6b6d86951 100644--- a/euicc/src/main/AndroidManifest.xml+++ b/euicc/src/main/AndroidManifest.xml@@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?>-<manifest xmlns:android="http://schemas.android.com/apk/res/android">+<manifest xmlns:android="http://schemas.android.com/apk/res/android"+ xmlns:tools="http://schemas.android.com/tools"> <!-- MAOS: opt out of the GrapheneOS Sensors permission (OTHER_SENSORS). --> <!-- This app uses no motion/environment sensors; MAOS withholds the -->@@ -7,9 +8,17 @@ <uses-permission android:name="com.vayunmathur.permission.SENSORS_OPTOUT" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" />- <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />- <uses-permission android:name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS" />- <uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />+ <!-- Privileged LPA permissions: granted only to the platform-signed LPA; inert when sideloaded. -->+ <uses-permission android:name="android.permission.MODIFY_PHONE_STATE"+ tools:ignore="ProtectedPermissions" />+ <uses-permission android:name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"+ tools:ignore="ProtectedPermissions" />+ <uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"+ tools:ignore="ProtectedPermissions" />+ <!-- Download progress notifications (DownloadService). Runtime grant on API 33+. -->+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />+ <!-- Telephony is optional hardware; the LPA reports "no eUICC" without it. -->+ <uses-feature android:name="android.hardware.telephony" android:required="false" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />@@ -77,7 +86,7 @@ android:excludeFromRecents="true" android:taskAffinity="" android:theme="@style/Theme.General">- <intent-filter>+ <intent-filter android:autoVerify="false"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" />
euicc/src/main/java/com/vayunmathur/euicc/telephony/EuiccChannelManager.kt
diff --git a/euicc/src/main/java/com/vayunmathur/euicc/telephony/EuiccChannelManager.kt b/euicc/src/main/java/com/vayunmathur/euicc/telephony/EuiccChannelManager.ktindex 8758b160ab..f1b0eefcf7 100644--- a/euicc/src/main/java/com/vayunmathur/euicc/telephony/EuiccChannelManager.kt+++ b/euicc/src/main/java/com/vayunmathur/euicc/telephony/EuiccChannelManager.kt@@ -1,10 +1,10 @@ package com.vayunmathur.euicc.telephony import android.content.Context+import android.os.Build import android.telephony.IccOpenLogicalChannelResponse import android.telephony.TelephonyManager import android.telephony.UiccCardInfo-import android.telephony.UiccPortInfo import com.vayunmathur.library.log.Log import com.vayunmathur.euicc.EuiccNative import java.lang.reflect.Method@@ -59,12 +59,22 @@ class EuiccChannelManager(context: Context) { val euicc = cards.firstOrNull { it.isEuicc } ?: throw EuiccException("no eUICC found (${cards.size} UICC card(s) reported)") + // Ports and physical slot indices are API 33+; on API 31-32 a card has exactly one+ // implicit port (port 0) and reports its slot through the pre-33 slotIndex getter. // Port 0 on a card that reports none: a non-MEP eUICC has exactly one implicit port.- val port: UiccPortInfo? = euicc.ports.firstOrNull()- val slotIndex = @Suppress("DEPRECATION") euicc.physicalSlotIndex+ val slotIndex: Int+ val portIndex: Int+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {+ slotIndex = euicc.physicalSlotIndex+ portIndex = euicc.ports.firstOrNull()?.portIndex ?: 0+ } else {+ @Suppress("DEPRECATION")+ slotIndex = euicc.slotIndex+ portIndex = 0+ } if (slotIndex < 0) throw EuiccException("eUICC reports no physical slot index") - val resolved = EuiccTarget(slotIndex, port?.portIndex ?: 0)+ val resolved = EuiccTarget(slotIndex, portIndex) Log.status(TAG, "eUICC at slot ${resolved.slotIndex} port ${resolved.portIndex}") return resolved }
euicc/src/main/res/values-et/strings.xml
diff --git a/euicc/src/main/res/values-et/strings.xml b/euicc/src/main/res/values-et/strings.xmlindex 44dfac3061..53f3a851b5 100644--- a/euicc/src/main/res/values-et/strings.xml+++ b/euicc/src/main/res/values-et/strings.xml@@ -3,7 +3,6 @@ <string name="esim_enabled">eSIM on kasutusel</string> <string name="available_carriers">Saadaval teenusepakkujad</string> <string name="add_profile_title">Lisa SIM-kaart</string>- <string name="add_new_carrier">Lisa uus teenusepakkuja</string> <string name="show_details">Näita üksikasju</string> <string name="no_profiles_title">Seadista eSIM</string> <string name="sgp22_version">SGP.22 versioon</string>@@ -28,7 +27,6 @@ <string name="no_profiles_body">Nutiseadme ühendamiseks mobiilivõrguga lisa oma teenusepakkuja SIM-kaart. Lisaks vajad QR-koodi või aktiveerimiskoodi.</string> <string name="eid_qr_code_dialog_title">Sinu seadme EID-kood</string> <string name="camera_permission_required">QR-koodi skaneerimiseks vajab see rakendus kaamera kasutamise õigust.</string>- <string name="no_euicc">eUICC pole selles nutiseadmes saadaval.</string> <string name="profile_status_enabled">Kasutusel</string> <string name="profile_status_disabled">Pole kasutusel</string> <string name="profile_iccid">ICCID-kood</string>@@ -49,7 +47,6 @@ <string name="carrier_confirm_subtitle">Sa juba peaksid olema selle võrguga seotud</string> <string name="confirmation_code_text_no_carrier">Selle eSIM-i seadistamiseks eeldab sinu teenusepakkuja kinnituskoodi kasutamist.</string> <string name="device_info_title">Seadme teave</string>- <string name="eid_title">EID-kood</string> <string name="eid_number">EIDnumber</string> <string name="eid_copied">EID-kood on kopeeritud lõikelauale</string> <string name="eid_not_found">Seadme EID-koodi ei leidu</string>
euicc/src/main/res/values/strings.xml
diff --git a/euicc/src/main/res/values/strings.xml b/euicc/src/main/res/values/strings.xmlindex b4738144f3..c626c34b75 100644--- a/euicc/src/main/res/values/strings.xml+++ b/euicc/src/main/res/values/strings.xml@@ -11,11 +11,9 @@ <string name="esim_enabled">eSIM enabled</string> <string name="available_carriers">Available carriers</string> <string name="add_profile_title">Add SIM</string>- <string name="add_new_carrier">Add new carrier</string> <string name="show_details">Show details</string> <string name="no_profiles_title">Set up an eSIM</string> <string name="no_profiles_body">Add a SIM from your carrier to connect this device to a mobile network. You will need a QR code or an activation code.</string>- <string name="no_euicc">No eUICC available on this device.</string> <!-- Profile status --> <string name="profile_status_enabled">Enabled</string>@@ -42,7 +40,6 @@ <!-- Device info --> <string name="device_info_title">Device info</string>- <string name="eid_title">EID</string> <string name="eid_number">EID number</string> <string name="eid_qr_code_dialog_title">Your device EID</string> <string name="eid_copied">EID copied to clipboard</string>