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

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

Merge "Print error msg when the grant/revoke appfunction command failed" into main

parents bdf7b7a6 4d3a5409
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ interface IAppFunctionManager {
        int targetUserId
    );

    void updateAppFunctionAccessFlags(
    boolean updateAppFunctionAccessFlags(
        in String agentPackageName,
        int agentUserId,
        in String targetPackageName,
+3 −3
Original line number Diff line number Diff line
@@ -538,13 +538,13 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub {
    }

    @Override
    public void updateAppFunctionAccessFlags(String agentPackageName, int agentUserId,
    public boolean updateAppFunctionAccessFlags(String agentPackageName, int agentUserId,
            String targetPackageName, int targetUserId, int flagMask, int flags)
            throws RemoteException {
        if (!accessCheckFlagsEnabled()) {
            return;
            return false;
        }
        mAppFunctionAccessService.updateAppFunctionAccessFlags(agentPackageName, agentUserId,
        return mAppFunctionAccessService.updateAppFunctionAccessFlags(agentPackageName, agentUserId,
                targetPackageName, targetUserId, flagMask, flags);
    }

+12 −4
Original line number Diff line number Diff line
@@ -449,8 +449,12 @@ public class AppFunctionManagerServiceShellCommand extends ShellCommand {
            return -1;
        }

        mService.updateAppFunctionAccessFlags(agentPackage, agentUserId, targetPackage,
                targetUserId, ACCESS_FLAG_MASK_OTHER, ACCESS_FLAG_OTHER_GRANTED);
        boolean result = mService.updateAppFunctionAccessFlags(agentPackage, agentUserId,
                targetPackage, targetUserId, ACCESS_FLAG_MASK_OTHER, ACCESS_FLAG_OTHER_GRANTED);
        if (!result) {
            pw.println("Error: Failed to grant the app function access.");
            return -1;
        }
        pw.println("Access granted successfully.");
        return 0;
    }
@@ -491,8 +495,12 @@ public class AppFunctionManagerServiceShellCommand extends ShellCommand {
            pw.println("Error: --target-package must be specified.");
            return -1;
        }
        mService.updateAppFunctionAccessFlags(agentPackage, agentUserId, targetPackage,
                targetUserId, ACCESS_FLAG_MASK_OTHER, ACCESS_FLAG_OTHER_DENIED);
        boolean result = mService.updateAppFunctionAccessFlags(agentPackage, agentUserId,
                targetPackage, targetUserId, ACCESS_FLAG_MASK_OTHER, ACCESS_FLAG_OTHER_DENIED);
        if (!result) {
            pw.println("Error: Failed to revoke the app function access.");
            return -1;
        }
        pw.println("Access revoked successfully.");
        return 0;
    }