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

Commit 5e26e4b6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Skip system dialer FGS grant if no dialer role is present." into main

parents afaaf340 922ef107
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -1328,6 +1328,13 @@ public abstract class ForegroundServiceTypePolicy {
            if (!android.app.Flags.systemDialerPhoneCallFgsGrant()) {
            if (!android.app.Flags.systemDialerPhoneCallFgsGrant()) {
                return PERMISSION_DENIED;
                return PERMISSION_DENIED;
            }
            }

            final RoleManager roleManager = context.getSystemService(RoleManager.class);
            if (!roleManager.isRoleAvailable(RoleManager.ROLE_DIALER)) {
                // If the Dialer role does not exist on the device, then there will not be a system
                // dialer which can use the phone call FGS type.
                return PERMISSION_DENIED;
            }
            final TelecomManager tm = context.getSystemService(TelecomManager.class);
            final TelecomManager tm = context.getSystemService(TelecomManager.class);
            final String systemDialerPackage = tm.getSystemDialerPackage();
            final String systemDialerPackage = tm.getSystemDialerPackage();
            return systemDialerPackage != null && systemDialerPackage.equals(packageName)
            return systemDialerPackage != null && systemDialerPackage.equals(packageName)