зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1510615 - Replace hardcoded /data/data paths or supress lint warning where not replaceable r=geckoview-reviewers,snorp
Differential Revision: https://phabricator.services.mozilla.com/D67980 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
d7433f922a
Коммит
7671f3baf7
|
@ -5,6 +5,7 @@
|
|||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
@ -376,6 +377,7 @@ public class CrashHandler implements Thread.UncaughtExceptionHandler {
|
|||
* @param exc An exception
|
||||
* @return Whether the exception was successfully reported
|
||||
*/
|
||||
@SuppressLint("SdCardPath")
|
||||
protected boolean reportException(final Thread thread, final Throwable exc) {
|
||||
final Context context = getAppContext();
|
||||
final String id = UUID.randomUUID().toString();
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.mozilla.gecko.annotation.JNITarget;
|
|||
import org.mozilla.gecko.annotation.RobocopTarget;
|
||||
import org.mozilla.gecko.util.HardwareUtils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
|
@ -322,14 +323,16 @@ public final class GeckoLoader {
|
|||
final StringBuilder message = new StringBuilder("LOAD ");
|
||||
message.append(lib);
|
||||
|
||||
final String packageDataDir = context.getApplicationInfo().dataDir;
|
||||
|
||||
// These might differ. If so, we know why the library won't load!
|
||||
HardwareUtils.init(context);
|
||||
message.append(": ABI: " + HardwareUtils.getLibrariesABI() + ", " + getCPUABI());
|
||||
message.append(": Data: " + context.getApplicationInfo().dataDir);
|
||||
message.append(": Data: " + packageDataDir);
|
||||
|
||||
try {
|
||||
final boolean appLibExists = new File("/data/app-lib/" + androidPackageName + "/lib" + lib + ".so").exists();
|
||||
final boolean dataDataExists = new File("/data/data/" + androidPackageName + "/lib/lib" + lib + ".so").exists();
|
||||
final boolean dataDataExists = new File(packageDataDir + "/lib/lib" + lib + ".so").exists();
|
||||
message.append(", ax=" + appLibExists);
|
||||
message.append(", ddx=" + dataDataExists);
|
||||
} catch (Throwable e) {
|
||||
|
@ -337,8 +340,8 @@ public final class GeckoLoader {
|
|||
}
|
||||
|
||||
try {
|
||||
final String dashOne = "/data/data/" + androidPackageName + "-1";
|
||||
final String dashTwo = "/data/data/" + androidPackageName + "-2";
|
||||
final String dashOne = packageDataDir + "-1";
|
||||
final String dashTwo = packageDataDir + "-2";
|
||||
final boolean dashOneExists = new File(dashOne).exists();
|
||||
final boolean dashTwoExists = new File(dashTwo).exists();
|
||||
message.append(", -1x=" + dashOneExists);
|
||||
|
@ -407,6 +410,7 @@ public final class GeckoLoader {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SdCardPath")
|
||||
public static void doLoadLibrary(final Context context, final String lib) {
|
||||
final Throwable e = doLoadLibraryExpected(context, lib);
|
||||
if (e == null) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче