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 { get isReady(): boolean {
return this.deviceStatus === ConnectionStatus.CONNECTED; return this.deviceStatus === ConnectionStatus.CONNECTED;
} }
runAdbCommand(adbCommandToRun) { runAdbCommand(adbCommandToRun, skipSettingResponse?: boolean) {
if (this.deviceStatus !== ConnectionStatus.CONNECTED) { if (this.deviceStatus !== ConnectionStatus.CONNECTED) {
return Promise.reject('Adb command failed - No device connected!'); return Promise.reject('Adb command failed - No device connected!');
} }
this.adbResponse = 'Loading...'; if (!skipSettingResponse) {
this.adbResponse = 'Loading...';
}
let command = adbCommandToRun.trim(); let command = adbCommandToRun.trim();
if (command.substr(0, 3).toLowerCase() === 'adb') { if (command.substr(0, 3).toLowerCase() === 'adb') {
command = command.substr(3); command = command.substr(3);
@@ -155,8 +157,12 @@ export class AdbClientService {
} }
); );
}).then((resp: string) => { }).then((resp: string) => {
this.adbResponse = resp.trim() || 'Command Completed.'; if (skipSettingResponse) {
return this.adbResponse; return resp.trim() || 'Command Completed.';
} else {
this.adbResponse = resp.trim() || 'Command Completed.';
return this.adbResponse;
}
}); });
} }
launchApp(packageName) { 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); clipboard.writeText(value);
} }
async getAppVersion(isCode: boolean): Promise<string | null> { 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'); this.notInstalled = versionInfo.includes('Unable to find package');
const versionParts = versionInfo const versionParts = versionInfo
.split('\n') .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; name = name || packageId;
const showTotal = number && total ? '(' + number + '/' + total + ') ' : ''; const showTotal = number && total ? '(' + number + '/' + total + ') ' : '';
if (!task) this.spinnerService.showLoader(); 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) { if (cb) {
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) { async getPackagePermissions(packagename) {
let requested_permissions = await this.runAdbCommand( let requested_permissions = '';
`adb shell "dumpsys package ${packagename} | grep permission | sed -n '/runtime permissions/,$p' | grep -v 'runtime'"` 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 = '', let granted_audio = '',
granted_read_storage = '', granted_read_storage = '',
granted_write_storage = ''; granted_write_storage = '';
try { try {
granted_audio = await this.runAdbCommand( 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 {} } catch {}
try { try {
granted_write_storage = await this.runAdbCommand( 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 {} } catch {}
try { try {
granted_read_storage = await this.runAdbCommand( 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 {} } catch {}
let read_perm = 'android.permission.READ_EXTERNAL_STORAGE'; let read_perm = 'android.permission.READ_EXTERNAL_STORAGE';
+5 -3
View File
@@ -125,9 +125,11 @@ export class ElectronService {
let url = data.split('#'); let url = data.split('#');
switch (url[0]) { switch (url[0]) {
case 'sidequest://w/': case 'sidequest://w/':
this.adbService.runAdbCommand('adb shell am start -a android.intent.action.VIEW -d ' + url[1]).then(() => { this.adbService
this.statusService.showStatus('Launching WebXR in browser...', false, true); .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; this.webviewService.isWebviewLoading = false;
break; break;
case 'sidequest://i/': case 'sidequest://i/':
@@ -124,8 +124,8 @@ export class HeaderBannerComponent implements OnInit {
console.warn(e); console.warn(e);
this.useBundledAPK(); this.useBundledAPK();
} }
await this.adb.runAdbCommand('push "' + this.appService.apkPath + '" /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'); await this.adb.runAdbCommand('shell pm install -r /data/local/tmp/sq.apk', true);
// this.toast.show('SideQuest installed to headset!'); // this.toast.show('SideQuest installed to headset!');
// this.showConfetti = true; // this.showConfetti = true;
this.adb.appVersionCode = await this.adb.getAppVersion(true); this.adb.appVersionCode = await this.adb.getAppVersion(true);
@@ -168,7 +168,7 @@ export class HeaderBannerComponent implements OnInit {
} }
async uninstall() { 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() { async userUninstall() {
@@ -305,7 +305,7 @@
</mz-modal-content> </mz-modal-content>
<mz-modal-footer> <mz-modal-footer>
<div class="pure-material-button-contained flat active spaced" (click)="adbModal.closeModal(); ">Close</div> <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-footer>
</mz-modal> </mz-modal>
@@ -107,14 +107,13 @@ export class PackagesComponent implements OnInit {
async triggerCloudBackup() { async triggerCloudBackup() {
this.cloudBackupLoading = true; this.cloudBackupLoading = true;
this.cloudBackupStatus = 'Starting backup...'; this.cloudBackupStatus = 'Starting backup...';
await this.adbService.runAdbCommand('adb shell bmgr backup @pm@'); await this.adbService.runAdbCommand('adb shell bmgr backup @pm@', true);
await this.adbService.runAdbCommand('adb shell bmgr run'); await this.adbService.runAdbCommand('adb shell bmgr run', true);
await this.adbService.runAdbCommand('adb shell cmd package list packages'); let packages: any = await this.adbService.runAdbCommand('adb shell cmd package list packages', true);
let packages: any = this.adbService.adbResponse;
packages = packages.split('\n').map(line => line.replace(/^package:/, '')); packages = packages.split('\n').map(line => line.replace(/^package:/, ''));
for (let i = 0; i < packages.length; i++) { for (let i = 0; i < packages.length; i++) {
this.cloudBackupStatus = `Backing up ${Math.round(((i + 1) / packages.length) * 100)}%`; 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.cloudBackupLoading = false;
this.cloudBackupDone = true; this.cloudBackupDone = true;
@@ -20,15 +20,15 @@ export class WirelessConnectionComponent implements OnInit {
let status = 'Attempting wifi connection...'; let status = 'Attempting wifi connection...';
this.statusService.showStatus(status, false, true); this.statusService.showStatus(status, false, true);
this.adbService.deviceStatusMessage = status; 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(() => { setTimeout(() => {
this.adbService.runAdbCommand('adb connect ' + this.adbService.deviceIp + ':5555'); this.adbService.runAdbCommand('adb connect ' + this.adbService.deviceIp + ':5555', true);
}, 3000); }, 3000);
}); });
} }
reset() { reset() {
this.adbService.runAdbCommand('adb disconnect'); this.adbService.runAdbCommand('adb disconnect', true);
this.statusService.showStatus('Resetting ADB connection...', false, true); this.statusService.showStatus('Resetting ADB connection...', false, true);
} }
+6 -2
View File
@@ -315,7 +315,9 @@ code > pre, .code{
margin-bottom: 1em; margin-bottom: 1em;
margin-right: 30px; margin-right: 30px;
} }
.pure-material-button-contained.spaced:last-child {
margin-right: 2px;
}
.pure-material-button-contained.slim{ .pure-material-button-contained.slim{
padding: 5px 10px; padding: 5px 10px;
height: 25px; height: 25px;
@@ -330,7 +332,9 @@ code > pre, .code{
background: transparent; background: transparent;
border: 2px solid #afafaf; border: 2px solid #afafaf;
color: #afafaf; color: #afafaf;
height: 40px; padding: 0 8px;
line-height: 30px;
height: 34px
} }
.pure-material-button-contained.small{ .pure-material-button-contained.small{
padding: 0 8px; padding: 0 8px;
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "SideQuest", "name": "SideQuest",
"productName": "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.", "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", "repository": "https://github.com/SideQuestVR/SideQuest.git",
"license": "UNLICENCED", "license": "UNLICENCED",