ui: Disable language picker for privileged OpenEUICC (for now)

...because AOSP is stupid and doesn't allow apps signed with the
platform key to use language settings.
This commit is contained in:
Peter Cai 2024-12-21 15:01:07 -05:00
parent 50ba81f131
commit bcd1295a18
2 changed files with 22 additions and 0 deletions

View file

@ -1,9 +1,14 @@
package im.angry.openeuicc.di
import androidx.fragment.app.Fragment
import im.angry.openeuicc.ui.EuiccManagementFragment
import im.angry.openeuicc.ui.PrivilegedEuiccManagementFragment
import im.angry.openeuicc.ui.PrivilegedSettingsFragment
class PrivilegedUiComponentFactory : DefaultUiComponentFactory() {
override fun createEuiccManagementFragment(slotId: Int, portId: Int): EuiccManagementFragment =
PrivilegedEuiccManagementFragment.newInstance(slotId, portId)
override fun createSettingsFragment(): Fragment =
PrivilegedSettingsFragment()
}

View file

@ -0,0 +1,17 @@
package im.angry.openeuicc.ui
import android.os.Bundle
import androidx.preference.Preference
class PrivilegedSettingsFragment : SettingsFragment() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
super.onCreatePreferences(savedInstanceState, rootKey)
// It's stupid to _disable_ things for privileged, but for now, the per-app locale picker
// is not usable for apps signed with the platform key.
// ref: <https://android.googlesource.com/platform/packages/apps/Settings/+/refs/tags/android-15.0.0_r6/src/com/android/settings/applications/AppLocaleUtil.java#60>
// This is disabled here, not moved to unprivileged, because I have hope that this will
// eventually work for platform-signed apps. Or, at some point we might introduce our own
// locale picker, which hopefully works whether privileged or not.
requirePreference<Preference>("pref_advanced_language").isVisible = false
}
}