diff --git a/README.md b/README.md index eb47a1f..7a0c09a 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ A fully free and open-source Local Profile Assistant implementation for Android There are two variants of this project: - OpenEUICC: The full-fledged privileged variant. Intended to be run as a privileged system app (inside `/system/priv-app`) and serve as the system LPA. This can be used to manage all kinds of eSIM chips, embedded or removable. + - The privileged variant can be imported to build along with AOSP by simply placing this repository and its [dependencies](https://gitea.angry.im/PeterCxy/android_prebuilts_openeuicc-deps) inside the AOSP tree. + - Note that **only the latest AOSP release** is supported. Older versions are still compatible with the app itself, but it may not compile within the old AOSP trees. For older versions, consider building the app with `gradle` or a newer AOSP source tree and simply import as a prebuilt apk. - EasyEUICC: Unprivileged version that can run as a user app. An eSIM chip must include the certificate of EasyEUICC in its ARA-M field in order to grant access without system privileges. This is intended for removable eSIM chips such as those provided by eSTK. - Prebuilt EasyEUICC apks can be downloaded [here](https://gitea.angry.im/PeterCxy/OpenEUICC/releases) - For removable eSIM chip vendors: to have your chip supported by official builds of EasyEUICC, include the ARA-M hash `2A2FA878BC7C3354C2CF82935A5945A3EDAE4AFA` diff --git a/app-common/build.gradle b/app-common/build.gradle index 5d258d1..1e9cecb 100644 --- a/app-common/build.gradle +++ b/app-common/build.gradle @@ -35,6 +35,7 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'com.google.android.material:material:1.10.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation "androidx.preference:preference-ktx:1.2.1" implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2' implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" implementation "androidx.cardview:cardview:1.0.0" diff --git a/app-common/src/main/AndroidManifest.xml b/app-common/src/main/AndroidManifest.xml index 2492952..a260db1 100644 --- a/app-common/src/main/AndroidManifest.xml +++ b/app-common/src/main/AndroidManifest.xml @@ -8,6 +8,10 @@ + + { + startActivity(Intent(this, SettingsActivity::class.java)); + true + } + else -> super.onOptionsItemSelected(item) + } + + protected open fun createEuiccManagementFragment(channel: EuiccChannel): EuiccManagementFragment = EuiccManagementFragment.newInstance(channel.slotId, channel.portId) diff --git a/app-common/src/main/java/im/angry/openeuicc/ui/SettingsActivity.kt b/app-common/src/main/java/im/angry/openeuicc/ui/SettingsActivity.kt new file mode 100644 index 0000000..f23fffd --- /dev/null +++ b/app-common/src/main/java/im/angry/openeuicc/ui/SettingsActivity.kt @@ -0,0 +1,24 @@ +package im.angry.openeuicc.ui + +import android.os.Bundle +import android.view.MenuItem +import androidx.appcompat.app.AppCompatActivity + +class SettingsActivity: AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + supportActionBar!!.setDisplayHomeAsUpEnabled(true) + supportFragmentManager.beginTransaction() + .replace(android.R.id.content, SettingsFragment()) + .commit() + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean = + when (item.itemId) { + android.R.id.home -> { + finish() + true + } + else -> super.onOptionsItemSelected(item) + } +} \ No newline at end of file diff --git a/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt b/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt new file mode 100644 index 0000000..f832e9f --- /dev/null +++ b/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt @@ -0,0 +1,24 @@ +package im.angry.openeuicc.ui + +import android.content.Intent +import android.net.Uri +import android.os.Bundle +import androidx.preference.Preference +import androidx.preference.PreferenceFragmentCompat +import im.angry.openeuicc.common.R +import im.angry.openeuicc.util.* + +class SettingsFragment: PreferenceFragmentCompat() { + override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { + setPreferencesFromResource(R.xml.pref_settings, rootKey) + + findPreference("pref_info_app_version") + ?.summary = requireContext().selfAppVersion + + findPreference("pref_info_source_code") + ?.setOnPreferenceClickListener { + startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(it.summary.toString()))) + true + } + } +} \ No newline at end of file diff --git a/app-common/src/main/java/im/angry/openeuicc/util/Utils.kt b/app-common/src/main/java/im/angry/openeuicc/util/Utils.kt new file mode 100644 index 0000000..e5a7d2e --- /dev/null +++ b/app-common/src/main/java/im/angry/openeuicc/util/Utils.kt @@ -0,0 +1,14 @@ +package im.angry.openeuicc.util + +import android.content.Context +import android.content.pm.PackageManager +import java.lang.RuntimeException + +val Context.selfAppVersion: String + get() = + try { + val pInfo = packageManager.getPackageInfo(packageName, 0) + pInfo.versionName + } catch (e: PackageManager.NameNotFoundException) { + throw RuntimeException(e) + } \ No newline at end of file diff --git a/app-common/src/main/res/menu/activity_main.xml b/app-common/src/main/res/menu/activity_main.xml index 9d1f42c..13275ab 100644 --- a/app-common/src/main/res/menu/activity_main.xml +++ b/app-common/src/main/res/menu/activity_main.xml @@ -7,4 +7,9 @@ app:actionViewClass="android.widget.Spinner" android:background="?android:attr/colorPrimary" app:showAsAction="always" /> + + \ No newline at end of file diff --git a/app-common/src/main/res/values/strings.xml b/app-common/src/main/res/values/strings.xml index c60a762..e983e06 100644 --- a/app-common/src/main/res/values/strings.xml +++ b/app-common/src/main/res/values/strings.xml @@ -32,4 +32,10 @@ New nickname Are you sure you want to delete the profile %s? This operation is irreversible. + + Settings + Info + App Version + Source Code + https://gitea.angry.im/PeterCxy/OpenEUICC \ No newline at end of file diff --git a/app-common/src/main/res/xml/pref_settings.xml b/app-common/src/main/res/xml/pref_settings.xml new file mode 100644 index 0000000..3e4edfe --- /dev/null +++ b/app-common/src/main/res/xml/pref_settings.xml @@ -0,0 +1,14 @@ + + + + + + + + \ No newline at end of file