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

Commit 1376bbfd authored by Jonathan Scott's avatar Jonathan Scott
Browse files

Fix connected apps for headless (was previously always checking allowed

apps on user 0).

Also correctly makes DISALLOW_DEBUGGING_FEATURES global to block adb on
HSUM

Test: Manual use of connected apps settings on HSUM
Fixes: 264853055
Fixes: 266542871
Change-Id: I5caecdeeefa42671f1410a07ce06646610256905
parent 3c78ba05
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -15495,7 +15495,7 @@ public class DevicePolicyManager {
        throwIfParentInstance("getAllCrossProfilePackages");
        if (mService != null) {
            try {
                return new ArraySet<>(mService.getAllCrossProfilePackages());
                return new ArraySet<>(mService.getAllCrossProfilePackages(mContext.getUserId()));
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
+1 −1
Original line number Diff line number Diff line
@@ -206,7 +206,7 @@ public abstract class DevicePolicyManagerInternal {
     *
     * @hide
     */
    public abstract List<String> getAllCrossProfilePackages();
    public abstract List<String> getAllCrossProfilePackages(int userId);

    /**
     * Returns the default package names set by the OEM that are allowed to communicate
+1 −1
Original line number Diff line number Diff line
@@ -515,7 +515,7 @@ interface IDevicePolicyManager {
    void setCrossProfilePackages(in ComponentName admin, in List<String> packageNames);
    List<String> getCrossProfilePackages(in ComponentName admin);

    List<String> getAllCrossProfilePackages();
    List<String> getAllCrossProfilePackages(int userId);
    List<String> getDefaultCrossProfilePackages();

    boolean isManagedKiosk();
+3 −1
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
 * limitations under the License.
 */
package com.android.server.pm;

import static android.Manifest.permission.CONFIGURE_INTERACT_ACROSS_PROFILES;
import static android.Manifest.permission.INTERACT_ACROSS_PROFILES;
import static android.Manifest.permission.INTERACT_ACROSS_USERS;
@@ -333,9 +334,10 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub {
    }

    private boolean isCrossProfilePackageAllowlisted(String packageName) {
        int userId = mInjector.getCallingUserId();
        return mInjector.withCleanCallingIdentity(() ->
                mInjector.getDevicePolicyManagerInternal()
                        .getAllCrossProfilePackages().contains(packageName));
                        .getAllCrossProfilePackages(userId).contains(packageName));
    }

    private boolean isCrossProfilePackageAllowlistedByDefault(String packageName) {
+1 −0
Original line number Diff line number Diff line
@@ -238,6 +238,7 @@ public class UserRestrictionsUtils {
                    UserManager.DISALLOW_CONFIG_DATE_TIME,
                    UserManager.DISALLOW_CONFIG_PRIVATE_DNS,
                    UserManager.DISALLOW_CHANGE_WIFI_STATE,
                    UserManager.DISALLOW_DEBUGGING_FEATURES,
                    UserManager.DISALLOW_WIFI_TETHERING,
                    UserManager.DISALLOW_WIFI_DIRECT,
                    UserManager.DISALLOW_ADD_WIFI_CONFIG,
Loading