fixed a bug in apps not showing with no permissions, and fixed a bug in the adb command screen

This commit is contained in:
Shane Harris
2022-08-05 07:53:21 +02:00
parent 5dbbcbcbbe
commit c38e48769a
8 changed files with 48 additions and 30 deletions
+25 -12
View File
@@ -134,11 +134,13 @@ export class AdbClientService {
get isReady(): boolean {
return this.deviceStatus === ConnectionStatus.CONNECTED;
}
runAdbCommand(adbCommandToRun) {
runAdbCommand(adbCommandToRun, skipSettingResponse?: boolean) {
if (this.deviceStatus !== ConnectionStatus.CONNECTED) {
return Promise.reject('Adb command failed - No device connected!');
}
this.adbResponse = 'Loading...';
if (!skipSettingResponse) {
this.adbResponse = 'Loading...';
}
let command = adbCommandToRun.trim();
if (command.substr(0, 3).toLowerCase() === 'adb') {
command = command.substr(3);
@@ -155,8 +157,12 @@ export class AdbClientService {
}
);
}).then((resp: string) => {
this.adbResponse = resp.trim() || 'Command Completed.';
return this.adbResponse;
if (skipSettingResponse) {
return resp.trim() || 'Command Completed.';
} else {
this.adbResponse = resp.trim() || 'Command Completed.';
return this.adbResponse;
}
});
}
launchApp(packageName) {
@@ -432,7 +438,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
clipboard.writeText(value);
}
async getAppVersion(isCode: boolean): Promise<string | null> {
const versionInfo = await this.runAdbCommand('shell dumpsys package ' + this.VR_APP_PACKAGE);
const versionInfo = await this.runAdbCommand('shell dumpsys package ' + this.VR_APP_PACKAGE, true);
this.notInstalled = versionInfo.includes('Unable to find package');
const versionParts = versionInfo
.split('\n')
@@ -1008,7 +1014,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
name = name || packageId;
const showTotal = number && total ? '(' + number + '/' + total + ') ' : '';
if (!task) this.spinnerService.showLoader();
let p: any = this.runAdbCommand('adb push "' + filepath + '" /sdcard/Android/obb/' + packageId + '/' + filename);
let p: any = this.runAdbCommand('adb push "' + filepath + '" /sdcard/Android/obb/' + packageId + '/' + filename, true);
if (cb) {
cb();
}
@@ -1102,25 +1108,32 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
}
async getPackagePermissions(packagename) {
let requested_permissions = await this.runAdbCommand(
`adb shell "dumpsys package ${packagename} | grep permission | sed -n '/runtime permissions/,$p' | grep -v 'runtime'"`
);
let requested_permissions = '';
try {
requested_permissions = await this.runAdbCommand(
`adb shell "dumpsys package ${packagename} | grep permission | sed -n '/runtime permissions/,$p' | grep -v 'runtime'"`,
true
);
} catch {}
let granted_audio = '',
granted_read_storage = '',
granted_write_storage = '';
try {
granted_audio = await this.runAdbCommand(
`adb shell "dumpsys package ${packagename} | grep 'android.permission.RECORD_AUDIO: granted=true'"`
`adb shell "dumpsys package ${packagename} | grep 'android.permission.RECORD_AUDIO: granted=true'"`,
true
);
} catch {}
try {
granted_write_storage = await this.runAdbCommand(
`adb shell "dumpsys package ${packagename} | grep 'android.permission.WRITE_EXTERNAL_STORAGE: granted=true'"`
`adb shell "dumpsys package ${packagename} | grep 'android.permission.WRITE_EXTERNAL_STORAGE: granted=true'"`,
true
);
} catch {}
try {
granted_read_storage = await this.runAdbCommand(
`adb shell "dumpsys package ${packagename} | grep 'android.permission.READ_EXTERNAL_STORAGE: granted=true'"`
`adb shell "dumpsys package ${packagename} | grep 'android.permission.READ_EXTERNAL_STORAGE: granted=true'"`,
true
);
} catch {}
let read_perm = 'android.permission.READ_EXTERNAL_STORAGE';
+5 -3
View File
@@ -125,9 +125,11 @@ export class ElectronService {
let url = data.split('#');
switch (url[0]) {
case 'sidequest://w/':
this.adbService.runAdbCommand('adb shell am start -a android.intent.action.VIEW -d ' + url[1]).then(() => {
this.statusService.showStatus('Launching WebXR in browser...', false, true);
});
this.adbService
.runAdbCommand('adb shell am start -a android.intent.action.VIEW -d ' + url[1], true)
.then(() => {
this.statusService.showStatus('Launching WebXR in browser...', false, true);
});
this.webviewService.isWebviewLoading = false;
break;
case 'sidequest://i/':
@@ -124,8 +124,8 @@ export class HeaderBannerComponent implements OnInit {
console.warn(e);
this.useBundledAPK();
}
await this.adb.runAdbCommand('push "' + this.appService.apkPath + '" /data/local/tmp/sq.apk');
await this.adb.runAdbCommand('shell pm install -r /data/local/tmp/sq.apk');
await this.adb.runAdbCommand('push "' + this.appService.apkPath + '" /data/local/tmp/sq.apk', true);
await this.adb.runAdbCommand('shell pm install -r /data/local/tmp/sq.apk', true);
// this.toast.show('SideQuest installed to headset!');
// this.showConfetti = true;
this.adb.appVersionCode = await this.adb.getAppVersion(true);
@@ -168,7 +168,7 @@ export class HeaderBannerComponent implements OnInit {
}
async uninstall() {
await this.adb.runAdbCommand('uninstall ' + this.adb.VR_APP_PACKAGE);
await this.adb.runAdbCommand('uninstall ' + this.adb.VR_APP_PACKAGE, true);
}
async userUninstall() {
@@ -305,7 +305,7 @@
</mz-modal-content>
<mz-modal-footer>
<div class="pure-material-button-contained flat active spaced" (click)="adbModal.closeModal(); ">Close</div>
<div class="pure-material-button-contained" (click)="runAdbCommand()">Run Command</div>
<div class="pure-material-button-contained spaced" (click)="runAdbCommand()">Run Command</div>
</mz-modal-footer>
</mz-modal>
@@ -107,14 +107,13 @@ export class PackagesComponent implements OnInit {
async triggerCloudBackup() {
this.cloudBackupLoading = true;
this.cloudBackupStatus = 'Starting backup...';
await this.adbService.runAdbCommand('adb shell bmgr backup @pm@');
await this.adbService.runAdbCommand('adb shell bmgr run');
await this.adbService.runAdbCommand('adb shell cmd package list packages');
let packages: any = this.adbService.adbResponse;
await this.adbService.runAdbCommand('adb shell bmgr backup @pm@', true);
await this.adbService.runAdbCommand('adb shell bmgr run', true);
let packages: any = await this.adbService.runAdbCommand('adb shell cmd package list packages', true);
packages = packages.split('\n').map(line => line.replace(/^package:/, ''));
for (let i = 0; i < packages.length; i++) {
this.cloudBackupStatus = `Backing up ${Math.round(((i + 1) / packages.length) * 100)}%`;
await this.adbService.runAdbCommand('adb shell bmgr fullbackup ' + packages[i]).then(o => console.log(o));
await this.adbService.runAdbCommand('adb shell bmgr fullbackup ' + packages[i], true).then(o => console.log(o));
}
this.cloudBackupLoading = false;
this.cloudBackupDone = true;
@@ -20,15 +20,15 @@ export class WirelessConnectionComponent implements OnInit {
let status = 'Attempting wifi connection...';
this.statusService.showStatus(status, false, true);
this.adbService.deviceStatusMessage = status;
((this.adbService.isReady ? this.adbService.runAdbCommand('adb tcpip 5555') : Promise.resolve()) as any).then(() => {
((this.adbService.isReady ? this.adbService.runAdbCommand('adb tcpip 5555', true) : Promise.resolve()) as any).then(() => {
setTimeout(() => {
this.adbService.runAdbCommand('adb connect ' + this.adbService.deviceIp + ':5555');
this.adbService.runAdbCommand('adb connect ' + this.adbService.deviceIp + ':5555', true);
}, 3000);
});
}
reset() {
this.adbService.runAdbCommand('adb disconnect');
this.adbService.runAdbCommand('adb disconnect', true);
this.statusService.showStatus('Resetting ADB connection...', false, true);
}
+6 -2
View File
@@ -315,7 +315,9 @@ code > pre, .code{
margin-bottom: 1em;
margin-right: 30px;
}
.pure-material-button-contained.spaced:last-child {
margin-right: 2px;
}
.pure-material-button-contained.slim{
padding: 5px 10px;
height: 25px;
@@ -330,7 +332,9 @@ code > pre, .code{
background: transparent;
border: 2px solid #afafaf;
color: #afafaf;
height: 40px;
padding: 0 8px;
line-height: 30px;
height: 34px
}
.pure-material-button-contained.small{
padding: 0 8px;
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "SideQuest",
"productName": "SideQuest",
"version": "0.10.29",
"version": "0.10.30",
"description": "A open app store for mobile android based VR devices such as the Levovo Mirage, Oculus Go, Oculus Quest, Vive Focus.",
"repository": "https://github.com/SideQuestVR/SideQuest.git",
"license": "UNLICENCED",