Loading libraries/android-bin/src/demo-mode.ts +1 −28 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ // cspell: ignore sysui import { Adb, AdbCommandBase } from '@yume-chan/adb'; import { Settings } from "./settings"; export enum DemoModeSignalStrength { Hidden = 'null', Loading @@ -26,34 +27,6 @@ export const DemoModeStatusBarModes = ['opaque', 'translucent', 'semi-transparen export type DemoModeStatusBarMode = (typeof DemoModeStatusBarModes)[number]; export type SettingsNamespace = 'system' | 'secure' | 'global'; // frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsService.java export class Settings extends AdbCommandBase { public run(command: string, namespace: SettingsNamespace, ...args: string[]) { return this.adb.childProcess.spawnAndWaitLegacy(['settings', command, namespace, ...args]); } public get(namespace: SettingsNamespace, key: string) { return this.run('get', namespace, key); } public delete(namespace: SettingsNamespace, key: string) { return this.run('delete', namespace, key); } public put(namespace: SettingsNamespace, key: string, value: string, tag?: string, makeDefault?: boolean) { return this.run( 'put', namespace, key, value, ...(tag ? [tag] : []), ...(makeDefault ? ['default'] : []), ); } } export class DemoMode extends AdbCommandBase { private settings: Settings; Loading libraries/android-bin/src/index.ts +2 −0 Original line number Diff line number Diff line export * from './bug-report'; export * from './demo-mode'; export * from './settings'; libraries/android-bin/src/settings.ts 0 → 100644 +32 −0 Original line number Diff line number Diff line import { AdbCommandBase } from "@yume-chan/adb"; export type SettingsNamespace = 'system' | 'secure' | 'global'; // frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsService.java export class Settings extends AdbCommandBase { // TODO: `--user <user>` argument // TODO: `reset` command public base(command: string, namespace: SettingsNamespace, ...args: string[]) { return this.adb.childProcess.spawnAndWaitLegacy(['settings', command, namespace, ...args]); } public get(namespace: SettingsNamespace, key: string) { return this.base('get', namespace, key); } public delete(namespace: SettingsNamespace, key: string) { return this.base('delete', namespace, key); } public put(namespace: SettingsNamespace, key: string, value: string, tag?: string, makeDefault?: boolean) { return this.base( 'put', namespace, key, value, ...(tag ? [tag] : []), ...(makeDefault ? ['default'] : []), ); } } Loading
libraries/android-bin/src/demo-mode.ts +1 −28 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ // cspell: ignore sysui import { Adb, AdbCommandBase } from '@yume-chan/adb'; import { Settings } from "./settings"; export enum DemoModeSignalStrength { Hidden = 'null', Loading @@ -26,34 +27,6 @@ export const DemoModeStatusBarModes = ['opaque', 'translucent', 'semi-transparen export type DemoModeStatusBarMode = (typeof DemoModeStatusBarModes)[number]; export type SettingsNamespace = 'system' | 'secure' | 'global'; // frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsService.java export class Settings extends AdbCommandBase { public run(command: string, namespace: SettingsNamespace, ...args: string[]) { return this.adb.childProcess.spawnAndWaitLegacy(['settings', command, namespace, ...args]); } public get(namespace: SettingsNamespace, key: string) { return this.run('get', namespace, key); } public delete(namespace: SettingsNamespace, key: string) { return this.run('delete', namespace, key); } public put(namespace: SettingsNamespace, key: string, value: string, tag?: string, makeDefault?: boolean) { return this.run( 'put', namespace, key, value, ...(tag ? [tag] : []), ...(makeDefault ? ['default'] : []), ); } } export class DemoMode extends AdbCommandBase { private settings: Settings; Loading
libraries/android-bin/src/index.ts +2 −0 Original line number Diff line number Diff line export * from './bug-report'; export * from './demo-mode'; export * from './settings';
libraries/android-bin/src/settings.ts 0 → 100644 +32 −0 Original line number Diff line number Diff line import { AdbCommandBase } from "@yume-chan/adb"; export type SettingsNamespace = 'system' | 'secure' | 'global'; // frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsService.java export class Settings extends AdbCommandBase { // TODO: `--user <user>` argument // TODO: `reset` command public base(command: string, namespace: SettingsNamespace, ...args: string[]) { return this.adb.childProcess.spawnAndWaitLegacy(['settings', command, namespace, ...args]); } public get(namespace: SettingsNamespace, key: string) { return this.base('get', namespace, key); } public delete(namespace: SettingsNamespace, key: string) { return this.base('delete', namespace, key); } public put(namespace: SettingsNamespace, key: string, value: string, tag?: string, makeDefault?: boolean) { return this.base( 'put', namespace, key, value, ...(tag ? [tag] : []), ...(makeDefault ? ['default'] : []), ); } }