Struct AdbShellPm

Source
pub struct AdbShellPm { /* private fields */ }

Implementations§

Source§

impl AdbShellPm

Source

pub fn new() -> Self

Source

pub fn list_packages(&mut self, list_packages: String) -> &mut Self

Prints all packages, optionally only those whose package name contains the text in filter.

Options:

  • -f: See their associated file.
  • -d: Filter to only show disabled packages.
  • -e: Filter to only show enabled packages.
  • -s: Filter to only show system packages.
  • -3: Filter to only show third party packages.
  • -i: See the installer for the packages.
  • -u: Also include uninstalled packages.
  • --user user_id: The user space to query.
Source

pub fn list_permission_groups( &mut self, list_permission_groups: String, ) -> &mut Self

Prints all known permission groups.

Source

pub fn list_permission(&mut self, list_permission: bool) -> &mut Self

Prints all known permissions, optionally only those in group.

Options:

  • -g: Organize by group.
  • -f: Print all information.
  • -s: Short summary.
  • -d: Only list dangerous permissions.
  • -u: List only the permissions users will see.
Source

pub fn list_instrumentation(&mut self, list_instrumentation: bool) -> &mut Self

List all test packages.

Options:

  • -f: List the APK file for the test package.
  • target_package: List test packages for only this app.
Source

pub fn list_features(&mut self, list_features: bool) -> &mut Self

Prints all features of the system.

Source

pub fn list_libraries(&mut self, list_libraries: bool) -> &mut Self

Prints all the libraries supported by the current device.

Source

pub fn list_users(&mut self, list_users: bool) -> &mut Self

Prints all users on the system.

Source

pub fn path_package(&mut self, path_package: &Path) -> &mut Self

Print the path to the APK of the given package.

Source

pub fn install_path(&mut self, install_path: &Path) -> &mut Self

Installs a package (specified by path) to the system.

Options:

  • -r: Reinstall an existing app, keeping its data.
  • -t: Allow test APKs to be installed. Gradle generates a test APK when you have only run or debugged your app or have used the Android Studio Build > Build APK command. If the APK is built using a developer preview SDK (if the targetSdkVersion is a letter instead of a number), you must include the -t option with the install command if you are installing a test APK.
  • -i installer_package_name: Specify the installer package name.
  • --install-location location: Sets the install location using one of the following values:
    • 0: Use the default install location
    • 1: Install on internal device storage
    • 2: Install on external media
  • -f: Install package on the internal system memory.
  • -d: Allow version code downgrade.
  • -g: Grant all permissions listed in the app manifest.
  • --fastdeploy: Quickly update an installed package by only updating the parts of the APK that changed.
  • --incremental: Installs enough of the APK to launch the app while streaming the remaining data in the background. To use this feature, you must sign the APK, create an [APK Signature Scheme v4 file], and place this file in the same directory as the APK. This feature is only supported on certain devices. This option forces adb to use the feature or fail if it is not supported (with verbose information on why it failed). Append the --wait option to wait until the APK is fully installed before granting access to the APK.
Source

pub fn uninstall(&mut self, uninstall: &Path) -> &mut Self

Removes a package from the system.

Options:

  • -k: Keep the data and cache directories around after package removal.
Source

pub fn clear(&mut self, clear: &Path) -> &mut Self

Deletes all data associated with a package.

Source

pub fn enable(&mut self, enable: &Path) -> &mut Self

Enable the given package or component (written as “package/class”).

Source

pub fn disable(&mut self, disable: &Path) -> &mut Self

Disable the given package or component (written as “package/class”).

Source

pub fn disable_user(&mut self, disable_user: &Path) -> &mut Self

Options:

--user user_id: The user to disable.

Source

pub fn grant(&mut self, grant: String) -> &mut Self

Grant a permission to an app. On devices running Android 6.0 (API level 23) and higher, the permission can be any permission declared in the app manifest. On devices running Android 5.1 (API level 22) and lower, must be an optional permission defined by the app.

Source

pub fn revoke(&mut self, revoke: String) -> &mut Self

Revoke a permission from an app. On devices running Android 6.0 (API level 23) and higher, the permission can be any permission declared in the app manifest. On devices running Android 5.1 (API level 22) and lower, must be an optional permission defined by the app.

Source

pub fn set_install_location( &mut self, set_install_location: InstallLocation, ) -> &mut Self

Changes the default install location. Location values:

  • 0: Auto: Let system decide the best location.
  • 1: Internal: install on internal device storage.
  • 2: External: on external media.
§Note

This is only intended for debugging; using this can cause apps to break and other undesireable behavior.

Source

pub fn get_install_location( &mut self, get_install_location: InstallLocation, ) -> &mut Self

Returns the current install location. Return values:

  • 0: Auto: Let system decide the best location.
  • 1: Internal: install on internal device storage.
  • 2: External: on external media.
Source

pub fn set_permission_enforced( &mut self, set_permission_enforced: bool, ) -> &mut Self

Specifies whether the given permission should be enforced.

Source

pub fn trim_caches(&mut self, trim_caches: &Path) -> &mut Self

Trim cache files to reach the given free space.

Source

pub fn create_user(&mut self, create_user: String) -> &mut Self

Create a new user with the given user_name, printing the new user identifier of the user.

Source

pub fn remove_user(&mut self, remove_user: String) -> &mut Self

Remove the user with the given user_id, deleting all data associated with that user

Source

pub fn get_max_users(&mut self, get_max_users: bool) -> &mut Self

Prints the maximum number of users supported by the device.

Source

pub fn f(&mut self, f: bool) -> &mut Self

Source

pub fn d(&mut self, d: bool) -> &mut Self

Source

pub fn e(&mut self, e: bool) -> &mut Self

Source

pub fn s(&mut self, s: bool) -> &mut Self

Source

pub fn third_party(&mut self, third_party: bool) -> &mut Self

Source

pub fn i(&mut self, i: bool) -> &mut Self

Source

pub fn u(&mut self, u: bool) -> &mut Self

Source

pub fn g(&mut self, g: bool) -> &mut Self

Source

pub fn r(&mut self, r: bool) -> &mut Self

Source

pub fn t(&mut self, t: bool) -> &mut Self

Source

pub fn k(&mut self, k: bool) -> &mut Self

Source

pub fn fastdeploy(&mut self, fastdeploy: bool) -> &mut Self

Source

pub fn no_incremental(&mut self, no_incremental: bool) -> &mut Self

Source

pub fn user(&mut self, user: String) -> &mut Self

Source

pub fn run(&self) -> Result<()>

Trait Implementations§

Source§

impl Clone for AdbShellPm

Source§

fn clone(&self) -> AdbShellPm

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for AdbShellPm

Source§

fn default() -> AdbShellPm

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.