Android P adb命令补充, device unlock

在android P版本上如果按照“FAQ18076 android 6.0 M userdebug版本执行adb remount失败”的做法在userdebug版本上执行adb remount会提示以下错误:
remount of the / superblock failed: Permission denied
remount failed
原因是android P版本后google启用avb(Android Verified Boot)2.0,verified boot and DM-verity默认启用策略发生了变化。详情如下:
DM-Verity behavior changes from vboot1.0 to avb2.0.
On vboot1.0, dm-verity is turned off on eng build and is enabled on userdebug/user build.
DM-verity could be disabled with adb (not fastboot) on userdebug build without unlocking device first.
DM-Verity could not be disabled on user build.
On avb2.0, dm-verity behavior are the same on all build variants.
It’s turned on by default and could only be disabled after device is unlocked.
dm-verity disable flag is moved from system image dm-verity metadata(vboot1.0) to vbmeta image(avb2.0), and you have two ways to disable it: adb and fastboot.


  • Android P + kernel-4.4 or kernel-3.18
  • download preloader with verified boot disabled which location is the same as scatter file //preloader__SBOOT_DIS.bin
  • adb root
  • adb disable-verity
  • adb reboot
  • adb root
  • adb remount
  • Android P + kernel-4.9 or after
  • download preloader with verified boot disabled which location is the same as scatter file. //preloader__SBOOT_DIS.bin
  • boot to Home Screen
  • go to setting -> system -> Developer options -> OEM unlocking
  • adb reboot bootloader
  • fastboot flashing unlock
  • press volume up key
  • fastboot reboot
  • adb root
  • adb disable-verity
  • adb reboot
  • adb root
  • adb remount

After Android P, preloader__SBOOT_DIS.bin will be generated automatically after building preloader.

发布了18 篇原创文章 · 获赞 13 · 访问量 1万+

Android无法解决permission denied for this window type


安卓学者请教各位大哥们:我的代码出现了哪里的问题 当我需要系统弹出一个系统对话框的时候老是报错 代码如下:这是我在Mainfest中注册的内容 ``` <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="" package="com.example.wangsj.broadcastbestpractice" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19"/> <uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" /> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".LoginActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".MainActivity"> </activity> <receiver android:name=".ForceOfflineReceiver"> <intent-filter> <action android:name="com.example.broadcastbestpractice.FORCE_OFFLINE"/> </intent-filter> </receiver> </application> </manifest> ``` 这是我在函数中调用系统对话框的的代码 ``` public class ForceOfflineReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, Intent intent) { AlertDialog.Builder dialogBulider = new AlertDialog.Builder(context); dialogBulider.setTitle("Warning"); dialogBulider.setMessage("You are forced to be offline . Please try login again"); dialogBulider.setCancelable(false); dialogBulider.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ActivityCollector.finishAll(); Intent intent = new Intent(context, LoginActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } }); AlertDialog alertDialog = dialogBulider.create(); alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);; } } ``` 我的模拟器用的是android6.0 api用的是23 我已经仔细核对了代码与《第一行代码》中的代码完全相同,为什么我的不能运行成功求解释。新人c币不多,请个各位大侠行行好 问答


©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客