Skip to content

Commit

Permalink
CMFileManager: Make groups command optional
Browse files Browse the repository at this point in the history
Groups command command is causing problems on some implementations (maybe toolbox?)
which don't recognize the root AID and returns an error, and avoid to get root access.

Patchset 2: Fix typo

Change-Id: Idc17b18c34b8be263a1739dbad2921f60101fa09
  • Loading branch information
jruesga committed Dec 16, 2012
1 parent 64aa1f4 commit 995e39a
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/com/cyanogenmod/filemanager/console/shell/ShellConsole.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,20 @@ public final void alloc() throws ConsoleAllocException {
getExecutableFactory().newCreator().createIdentityExecutable();
execute(identityCmd);
this.mIdentity = identityCmd.getResult();
if (this.mIdentity.getGroups().size() == 0) {
//Try with groups
GroupsExecutable groupsCmd =
getExecutableFactory().newCreator().createGroupsExecutable();
execute(groupsCmd);
this.mIdentity.setGroups(groupsCmd.getResult());
// Identity command is required for root console detection,
// but Groups command is not used for now. Also, this command is causing
// problems on some implementations (maybe toolbox?) which don't
// recognize the root AID and returns an error. Safely ignore on error.
try {
if (this.mIdentity.getGroups().size() == 0) {
//Try with groups
GroupsExecutable groupsCmd =
getExecutableFactory().newCreator().createGroupsExecutable();
execute(groupsCmd);
this.mIdentity.setGroups(groupsCmd.getResult());
}
} catch (Exception ex) {
Log.w(TAG, "Groups command failed. Ignored.", ex);
}

} catch (Exception ex) {
Expand Down

0 comments on commit 995e39a

Please sign in to comment.