跳转至

屏幕坏一加手机刷android10

目的:获取一个可运行的开源Android10环境

环境:一加一(OnePlus One )手机;LineageOS 17版本;手机下半部分触屏无响应

1、网络搜索“twrp 屏幕坏”,获得如下命令:

https://github.com/xiongyihui/notes/issues/11

还好Android可以替换recovery,而TWRP刚好是个功能很强大的recovery,可以不用触摸屏幕完成文件拷贝、刷机等功能。在TWRP上下载Nexus 4的recovery,然后通过TWRP的Commandline把Android的ADB开启,并且把PC上的~/.android/adbkey.pub上传到Android上。
TWRP支持ADB,运行TWRP命令如下:

adb shell twrp remountrw
adb push file.zip /sdcard
adb shell twrp install /sdcard/file.zip

配置ADB,可以参考 https://gist.github.com/varhub/7b9555cdd1e5ad785ffde2300fcfd0bd

配置ADB,备份 Android - Enable ADB from recovery

2、下载bacon最新版LineageOS

https://download.lineageos.org/bacon

页面有对应的安装wiki:https://wiki.lineageos.org/devices/bacon/install

此处我下载的是lineage-17.1-20210311-nightly-bacon-signed.zip

3、刷入 lineage-17.1 :

执行命令:

adb reboot recovery  #进入twrp环境
adb push  lineage-17.1-20210311-nightly-bacon-signed.zip  /sdcard/0/ #推入升级包
adb shell twrp install  /sdcard/0/ lineage-17.1-20210311-nightly-bacon-signed.zip  #刷入升级包 

4、效果:~~重启到twrp界面~~

5、搜索刷机过程:

  • Backup everything to the PC, so you will need to copy all your data over.
  • Sync all your accounts, etc.
  • In TWRP format data. Reboot recovery
  • Factory Reset.
  • Flash Lineage
  • Flash TWRP Installer
  • Reboot to Recovery
  • Flash Lineage (This is only the first time, to get the *** rom on both slots, only do this for the first install)
  • Flash TWRP Installer (This is only the first time, to get the *** rom on both slots, only do this for the first install)
  • Reboot to Recovery (This is only the first time, to get the *** rom on both slots, only do this for the first install)
  • Flash Gapps
  • Flash Magisk
  • Reboot to System.
  • Then you should be able to setup the device, copy everything back over. Restore your data.

根据上述描述:

备份data
同步账号
TWRP格式化手机,重启到recovery
。。。
刷入LineageOS
刷入TWRP安装器
重启到Recovery
刷入Gapps
刷让Magisk
重启系统

6、操作:

E:\OnePlus>adb shell twrp
TWRP openrecoveryscript command line tool, TWRP version 3.2.1-0

Allows command line usage of TWRP via openrecoveryscript commands.
Some common commands include:
  install /path/to/update.zip
  backup <SDCRBAEM> [backupname]
  restore <SDCRBAEM> [backupname]
  wipe <partition name>
  sideload
  set <variable> [value]
  decrypt <password>
  remountrw

See more documentation at https://twrp.me/faq/openrecoveryscript.html
E:\OnePlus>adb shell twrp wipe data
Wiping data without wiping /data/media ...
Done.
Formatting Cache using make_ext4fs...
Done processing script file

E:\OnePlus>adb shell twrp wipe system
Formatting System using make_ext4fs...
Done processing script file
E:\OnePlus>adb shell twrp install /sdcard/0/lineage-17.1-20210311-nightly-bacon-signed.zip
Installing zip file '/sdcard/0/lineage-17.1-20210311-nightly-bacon-signed.zip'
Checking for Digest file...
Skipping Digest check: no Digest file found
Warning: No file_contextsComparing TZ version TZ.BF.2.0-2.0.0109 to TZ.BF.2.0-2.0.0123Comparing TZ version TZ.BF.2.0-2.0.0123 to TZ.BF.2.0-2.0.0123Target: oneplus/bacon/A0001:5.0.2/LRX22G/YNG1TAS0YL:user/release-keysPatching system image unconditionally...script succeeded: result was [1.000000]Done processing script file

此时进入LineageOS开机向导(SetupWizard)界面,但是没有root,连接不了设备。按键Power + 音量加 + 音量减进入Recovery模式(TWRP界面):

下载Magisk刷入root,刷入Open_gapps:

根据 https://github.com/topjohnwu/Magisk/releases/https://www.didgeridoohan.com/magisk/HomePage 下载 Magisk-v22.0.apk

根据 https://wiki.lineageos.org/gapps.html 下载 https://opengapps.org/?api=10.0&variant=nano

E:\OnePlus>adb shell twrp install /sdcard/0/open_gapps-arm-10.0-nano-20210314.zip
Installing zip file '/sdcard/0/open_gapps-arm-10.0-nano-20210314.zip'
Checking for Digest file...
Skipping Digest check: no Digest file found

##############################
  _____   _____   ___   ____
 /  _  \ |  __ \ / _ \ |  _ \
|  / \  || |__) | |_| || | \ \
| |   | ||  ___/|  __/ | | | |
|  \ /  || |    \ |__  | | | |
 \_/ \_/ |_|     \___| |_| |_|
       ___   _   ___ ___  ___
      / __| /_\ | _ \ _ \/ __|
     | (_ |/ _ \|  _/  _/\__ \
      \___/_/ \_\_| |_|  |___/
##############################

Open GApps nano 10.0 - 20210314

- Mounting partitions

- Gathering device & ROM information

- Performing system space calculations

- Removing existing/obsolete Apps

- Installing core GApps

- Installing swypelibs
- Installing batteryusage
- Installing calsync
- Installing dialerframework
- Installing googletts
- Installing markup
- Installing packageinstallergoogle
- Installing search
- Installing soundpicker
- Installing speech
- Installing wellbeing

- Miscellaneous tasks

- Copying Log to /sdcard/0

- Installation complete!

- Unmounting partitions

Done processing script file
E:\OnePlus>adb push Magisk-v22.0.zip /sdcard/0/
Magisk-v22.0.zip: 1 file pushed, 0 skipped. 4.0 MB/s (7513409 bytes in 1.797s)

E:\OnePlus>adb shell twrp install /sdcard/0/Magisk-v22.0.zip
Installing zip file '/sdcard/0/Magisk-v22.0.zip'
Checking for Digest file...
Skipping Digest check: no Digest file found
***********************
 Magisk 22.0 Installer
***********************
- Device is system-as-root
- Mounting /apex/com.android.conscrypt
- Mounting /apex/com.android.media
- Mounting /apex/com.android.media.swcodec
- Mounting /apex/com.android.resolv
- Mounting /apex/com.android.runtime
- Mounting /apex/com.android.tzdata
- System-as-root, keep dm/avb-verity
- Target image: /dev/block/mmcblk0p7
- Device platform: arm
- Constructing environment
- Adding addon.d survival script
- Unpacking boot image
- Checking ramdisk status
- Stock boot image detected
- Patching ramdisk
- Repacking boot image
- Flashing new boot image
- Unmounting partitions
- Done
Done processing script file

~~开机向导界面没有连上adb,且不能跳过~~

7、移除 SUW( 开机向导 )

按键( Power + 音量加 + 音量减 )进入TWRP(Recovery模式)

#执行命令:adb shell进入手机的命令模式
mount system  #挂载system分区到/system目录
mv /system/system/priv-app/SetupWizard/ /sdcard/
mv /system/system/priv-app/LineageSetupWizard/ /sdcard/

重启后进入桌面,此时打不开设置,连不上WIFI、蓝牙。但是可以设置屏幕旋转

8、恢复SUW ( 开机向导 ) :

按键( Power + 音量加 + 音量减 )进入TWRP(Recovery模式)

执行命令:adb shell进入手机的命令模式
mount system  #挂载system分区到/system目录
mv /sdcard/SetupWizard/ /system/system/priv-app/
mv /sdcard/LineageSetupWizard/ /system/system/priv-app/

重启后进入开机向导,此时可以旋转屏幕。

9、 SUW界面,通过旋转屏幕, 连接WIFI界面跳过 ,走完所有点击。

10、进入正常界面,通过设置,打开开发者选项,通过scrcpy连接手机操作。

参考 https://github.com/Genymobile/scrcpy/issues/1443

scrcpy --max-size 1024 --bit-rate 15M --max-fps 30 --render-driver=opengl 
并停用动画效果: 设置>开发者选项,找到Window animation scale, Transition animation scale, and Animator duration scale. 从默认的x1改成off

11、连接WIFI,安装科学上网APK,点击桌面上的Magisk,安装ROOT

12、效果:

原文链接: http://droid10.com/2021/03/16/屏幕坏一加手机刷android10/