Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d0d08362 authored by David Lin's avatar David Lin Committed by Android (Google) Code Review
Browse files

Merge "Fix to hide Display over other apps permission setting for the Scone...

Merge "Fix to hide Display over other apps permission setting for the Scone application." into 24D1-dev
parents 083fda36 74670e49
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1517,4 +1517,8 @@
        <item>2</item>
    </string-array>

    <!-- Packages that will not show Display over other apps permission -->
    <string-array name="display_over_apps_permission_change_exempt" translatable="false">
    </string-array>

</resources>
+10 −0
Original line number Diff line number Diff line
@@ -44,6 +44,16 @@ class DisplayOverOtherAppsListModel(context: Context) : AppOpPermissionListModel
        logPermissionChange(newAllowed)
    }

    // TODO(b/349195999)
    override fun isChangeable(record: AppOpPermissionRecord): Boolean {
        if (record.app.packageName in
            context.resources.getStringArray(R.array.display_over_apps_permission_change_exempt)
            && record.app.isSystemApp()) {
            return false
        }
        return super.isChangeable(record)
    }

    private fun logPermissionChange(newAllowed: Boolean) {
        val category = when {
            newAllowed -> SettingsEnums.APP_SPECIAL_PERMISSION_APPDRAW_ALLOW