Added the Gapps Resolution to the code. It now removes data from the media provider to ensure that the system is now correct after reboot.
diff --git a/src/com/fairphone/updater/fragments/DownloadAndRestartFragment.java b/src/com/fairphone/updater/fragments/DownloadAndRestartFragment.java
index 5b58703..9a4f084 100644
--- a/src/com/fairphone/updater/fragments/DownloadAndRestartFragment.java
+++ b/src/com/fairphone/updater/fragments/DownloadAndRestartFragment.java
@@ -602,6 +602,17 @@
removeLastUpdateDownload();
}
+ // remove the gapps stuff
+// String model = Utils.getModelAndOS(getActivity());
+// if( model.contains("FP1") ) {
+ try {
+
+ Utils.clearGappsData();
+ } catch (RootDeniedException | InterruptedException | IOException e) {
+ e.printStackTrace();
+ }
+// }
+
// remove the update files from data
removeUpdateFilesFromData();
diff --git a/src/com/fairphone/updater/tools/Utils.java b/src/com/fairphone/updater/tools/Utils.java
index 02e53cc..594e299 100644
--- a/src/com/fairphone/updater/tools/Utils.java
+++ b/src/com/fairphone/updater/tools/Utils.java
@@ -40,6 +40,7 @@
import com.stericson.RootTools.execution.CommandCapture;
import com.stericson.RootTools.execution.Shell;
+import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -598,4 +599,58 @@
}
return fileExists;
}
+
+ private final static String[] fp1Commands = {
+ // remove data
+ "rm -rf /data/data/com.android.providers.media*",
+ "rm -rf /data/data/com.android.keychain*",
+ "rm -rf /data/data/com.android.location.fused*",
+ "rm -rf /data/data/com.android.providers.applications*",
+ "rm -rf /data/data/com.android.providers.media*",
+ "rm -rf /data/data/com.android.vending*",
+ "rm -rf /data/data/com.google.android.apps.genie.geniewidget*",
+ "rm -rf /data/data/com.google.android.apps.plus*",
+ "rm -rf /data/data/com.google.android.ears*",
+ "rm -rf /data/data/com.google.android.gms*",
+ "rm -rf /data/data/com.google.android.googlequicksearchbox*",
+ "rm -rf /data/data/com.google.android.location*",
+ "rm -rf /data/data/com.google.android.marvin.talkback*",
+ // remove cache
+ "rm -rf /data/dalvik-cache",
+ // remove data/app
+ "rm -rf /data/app/com.android.apps.plus*",
+ "rm -rf /data/app/com.android.vending*",
+ "rm -rf /data/app/com.android.easr*",
+ "rm -rf /data/app/com.android.gms*",
+ "rm -rf /data/app/com.android.tts*"
+ };
+
+ public final static String SHELL_COMMAND_SU = "su";
+ public final static String SHELL_COMMAND_EXIT = "exit";
+
+ public static void clearGappsData() throws RootDeniedException, IOException, InterruptedException {
+
+ if (PrivilegeChecker.isPrivilegedApp()) {
+ Process p = Runtime.getRuntime().exec(SHELL_COMMAND_SU);
+ DataOutputStream os = new DataOutputStream(p.getOutputStream());
+ for (String tmpCmd : fp1Commands) {
+ os.writeBytes(tmpCmd+"\n");
+ }
+ os.writeBytes(SHELL_COMMAND_EXIT+"\n");
+ os.flush();
+ p.waitFor();
+ }else {
+ if(RootTools.isAccessGiven()) {
+ for (String tmpCmd : fp1Commands) {
+ try {
+ Shell.runRootCommand(new CommandCapture(0, tmpCmd));
+ } catch (TimeoutException e) {
+ e.printStackTrace();
+ }
+ }
+ }else{
+ throw new RootDeniedException("Root Denied");
+ }
+ }
+ }
}