• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#
3# Copyright 2021 The ANGLE Project Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6#
7
8declare -a Packages=("com.android.chrome" "com.android.phone" "com.google.android.apps.gcs" "com.google.android.apps.internal.betterbug" "com.google.android.apps.nbu.files" "com.google.android.apps.scone" "com.google.android.apps.work.clouddpc" "com.google.android.as" "com.google.android.contacts" "com.google.android.dialer" "com.google.android.googlequicksearchbox" "com.google.android.ims" "com.google.android.tts" "com.google.android.videos" "com.google.android.GoogleCamera" "com.google.android.apps.maps" "com.google.android.apps.photos" "com.google.android.apps.youtube.music" "com.google.android.youtube" "com.google.android.apps.docs" "com.google.android.apps.gcs" "com.google.android.apps.messaging" "com.google.android.apps.turbo" "com.google.android.apps.tycho" "com.google.android.calculator" "com.google.android.calendar" "com.google.android.configupdater" "com.google.android.contacts" "com.google.android.deskclock" "com.google.android.gm" "com.google.android.inputmethod.latin" "com.google.android.marvin.talkback" "com.google.android.videos" "com.android.ramdump" "com.google.android.volta" "com.google.android.settings.intelligence" "com.google.android.partnersetup" "com.google.android.apps.tips" "com.android.vending")
9
10SetGservicesFlag() (
11  echo "Setting $1 to $2 -START"
12  adb shell am broadcast -a com.google.gservices.intent.action.GSERVICES_OVERRIDE \
13      -e "${1}" "${2}"
14  wanted="${1}=${2}"
15  i=1
16  while [[ $i -le 20 ]]
17  do
18    echo "Try #$i:"
19    if adb shell dumpsys activity provider GservicesProvider | grep "$wanted" &>/dev/null;
20    then
21      echo "Succeeded"
22      break
23    else
24      echo "Failed"
25      sleep 0.05
26    fi
27    (( i++ ))
28  done
29  echo "Setting $1 to $2 -Done"
30)
31
32adb root
33
34# Disable unnecessary packages
35for val in ${StringArray[@]}; do
36   adb shell pm disable $val
37done
38
39# Disable modem logging, ambient EQ, and adaptive brightness.
40adb shell setprop vendor.sys.modem.diag.mdlog false
41adb shell settings put secure display_white_balance_enabled 0
42adb shell settings put system screen_brightness_mode 0
43
44# Disable bg dex2oat
45adb shell setprop pm.dexopt.disable_bg_dexopt true
46
47# Disable moisture detection
48contaminant_detection_node=$(adb shell find /sys -name contaminant_detection)
49adb shell "echo 0 > ${contaminant_detection_node}"
50adb shell setprop vendor.usb.contaminantdisable true
51
52# Direct Phenotype to a local Heterodyne server.
53SetGservicesFlag gms:phenotype:debug_allow_http "true"
54SetGservicesFlag gms:phenotype:configurator:service_url "http://localhost:9879"
55
56# Remove any production configurations already downloaded.
57# Restarts GMS Core.
58adb shell pm clear com.google.android.gms
59
60adb shell stop
61adb shell start
62sleep 40s
63adb shell input keyevent 82
64