一半君的总结纸

听话只听一半君

未root的Note 5 在 CentOS 7 下为绿色守护开启权限

根据作者官网说明

  1. 如果手机上没有 Settings – Developer options, 就去 Settings – About”, 然后连续点击 “Build number” 直到出现 “You are now a developer”, 然后去 “Settings – Developer options” 里打开 “USB debugging”.
  2. 安装openjdk
    yum install java-1.8.0-openjdk
    

    装好以后

    $ java -version
    openjdk version "1.8.0_111"
    OpenJDK Runtime Environment (build 1.8.0_111-b15)
    OpenJDK 64-Bit Server VM (build 25.111-b15, mixed mode)
    
  3. Installing Android SDK
    去官网 Android Developer Website 下载 just the command line tools

    android_developer_just_commandline_tools

    把 tools_r25.2.3-linux.zip 解开以后,里面有个可执行文件 android, 他其实是 Android SDK Manager,打开并下载安装 Android SDK Tools 和 Android SDK Platform-tools

    android_developer_platform_tools

  4. 运行lsusb
    $ lsusb
    Bus 003 Device 002: ID 8087:8001 Intel Corp. 
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 007: ID 04f2:b449 Chicony Electronics Co., Ltd 
    Bus 001 Device 005: ID 8087:0a2a Intel Corp. 
    Bus 001 Device 003: ID 138a:0017 Validity Sensors, Inc. Fingerprint Reader
    Bus 001 Device 009: ID 04e8:6860 Samsung Electronics Co., Ltd Galaxy (MTP)
    Bus 001 Device 008: ID 046d:c077 Logitech, Inc. M105 Optical Mouse
    Bus 001 Device 006: ID 046d:c31c Logitech, Inc. Keyboard K120
    Bus 001 Device 004: ID 05e3:0723 Genesys Logic, Inc. GL827L SD/MMC/MS Flash Card Reader
    Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. Hub
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    

    记录Samsung的那一行 04e8:6860, 他们分别是idVendor 和 idProduct 新建文件

    # Samsung
    SUBSYSTEM=="usb", ATTR{idVendor}=="04e8" ATTR{idProduct}=="6860", MODE="0666", GROUP="plugdev"
    

    然后

    systemctl restart systemd-udevd
    
    # cd ../platform-tools
    ./adb kill-server
    ./adb start-server
    ./adb devices
    

    如果看到

    $ ./adb devices
    List of devices attached
    83f0434758423557        device
    

    就说明连接成功了

  5. 然后就可以运行以下命令了

    # Aggressive Doze on Android 7.0+ (non-root):
    adb -d shell pm grant com.oasisfeng.greenify android.permission.WRITE_SECURE_SETTINGS
    
    # Doze on the Go:
    adb -d shell pm grant com.oasisfeng.greenify android.permission.DUMP
    
    # Aggressive Doze (on device/ROM with Doze disabled):
    adb -d shell pm grant com.oasisfeng.greenify android.permission.DUMP
    
    # Wake-up Tracker:
    adb -d shell pm grant com.oasisfeng.greenify android.permission.READ_LOGS
    
    # Wake-up Cut-off: (Android 4.4~5.x)
    adb -d shell pm grant com.oasisfeng.greenify android.permission.READ_LOGS
    adb -d shell pm grant com.oasisfeng.greenify android.permission.WRITE_SECURE_SETTINGS
    
  6. island 跳过device encryption设置
    adb -d shell
    
    # 然后
    pm create-user --profileOf 0 --managed Island
    # 我的id是10
    
    pm install -r /data/app/com.oasisfeng.island-1/base.apk
    
    # Android 6+
    dpm set-profile-owner --user <user id> com.oasisfeng.island/.IslandDeviceAdminReceiver
    
    # Android 5.x: 
    dpm set-profile-owner com.oasisfeng.island/.IslandDeviceAdminReceiver <user id>
    
    am start-user <user id>
    

参考:
How to grant permissions required by some features on non-root device?
Setting Up ADB on Linux
island setup guide – oasis feng

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: