hide <package> | 隐藏应用 | PMS.setApplicationHiddenSettingAsUser |
adb shell pm hide/unhide package
system_process W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.iffy.car flg=0x4000010 (has extras) }
adb shell pm unhide package
BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.iffy.car flg=0x4000010 (has extras) }
/**
* Puts the package in a hidden state, which is almost like an uninstalled state,
* making the package unavailable, but it doesn't remove the data or the actual
* package file. Application can be unhidden by either resetting the hidden state
* or by installing it, such as with {@link #installExistingPackage(String)}
* @hide
*/
@UnsupportedAppUsage
public abstract boolean setApplicationHiddenSettingAsUser(@NonNull String packageName,
boolean hidden, @NonNull UserHandle userHandle);
/**
* Returns the hidden state of a package.
* @see #setApplicationHiddenSettingAsUser(String, boolean, UserHandle)
* @hide
*/
@UnsupportedAppUsage
public abstract boolean getApplicationHiddenSettingAsUser(@NonNull String packageName,
@NonNull UserHandle userHandle);
代码实现
//you need to remove all accounts from the device before running the commands in this blog, // I just removed them in on the device in Settings > Accounts, no factory reset required for me. //adb shell dpm set-profile-owner com.iffy.car/com.iffy.car.fawvw.MyAdmin dpm.setApplicationHidden(ownerComponent, "com.iffy.mzc", newHiddenValue);
博客主要展示了使用adb shell命令实现应用隐藏与显示的相关内容。通过adb shell pm hide/unhide package命令操作,还给出了系统相关提示信息,最后提及代码实现。
1209

被折叠的 条评论
为什么被折叠?



