title: How to update the system app by itself with android 9 and above
body: <p>I've a device with root access. Here is a system app with a function allow the system app can update by itself. It works on Android 4, but fail on Android 9. The new apk file can be copy to /system/app/ folder correctly, but not update the app after reboot. Here's the code I have:</p>
  <pre><code>final String libs = &quot;LD_LIBRARY_PATH=/vendor/lib:/system/lib &quot;;
  final String[] commands = new String[]{
      libs + &quot;mount -o rw,remount /&quot;,
      libs + &quot;cp -rf &quot; + StorageUtil.getInstance().getRootDir() + &quot;/app.apk /system/app/&quot;,
      libs + &quot;chmod 644 /system/app/app.apk&quot;,
      libs + &quot;mount -o ro,remount /&quot;,
  };
  RootUtil.executeAsRoot(commands);
  </code></pre>