title: Modify battery percentage on real Android device
body: <p>I have a rooted Galaxy S6 and I want to modify the battery percentage of the device for test purposes. I want that Android 'thinks' it has X percent battery...
  I have already found that the percentage is stored at:</p>
  
  <pre><code>/sys/class/power_supply/battery/capacity
  </code></pre>
  
  <p>But when I try to modify the file, it says:</p>
  
  <pre><code>tmp-mksh: can't create capacity: Permission denied
  </code></pre>
  
  <p>Even if I try as root...
  Is there some way to modify the percentage of the battery?</p>
  
  <p>EDIT: I tried this too:</p>
  
  <pre><code>Microsoft Windows [versão 6.1.7601]
  Copyright (c) 2009 Microsoft Corporation. Todos os direitos reservados.
  
  C:\Users\Valentino&gt;adb root
  adbd cannot run as root in production builds
  
  C:\Users\Valentino&gt;adb shell
  shell@zerolte:/ $ su
  su
  root@zerolte:/ # setenforce 0
  setenforce 0
  root@zerolte:/ # echo 45 &gt;&gt; /sys/class/power_supply/battery/capacity
  echo 45 &gt;&gt; /sys/class/power_supply/battery/capacity
  tmp-mksh: can't create /sys/class/power_supply/battery/capacity: Permission deni
  ed
  1|root@zerolte:/ #
  </code></pre>
  
  <p>It doesn't work either...</p>