Bug 1149780 - Uncomment code block that depends on SDK 17 & delete try-catch block that uses reflection. r=jchen

This commit is contained in:
Raunaq Abhyankar 2016-01-15 09:07:00 -05:00
Родитель 478ad666bf
Коммит 3ed0ef64a7
1 изменённых файлов: 1 добавлений и 19 удалений

Просмотреть файл

@ -162,10 +162,7 @@ public final class GeckoLoader {
f = context.getCacheDir(); f = context.getCacheDir();
putenv("CACHE_DIRECTORY=" + f.getPath()); putenv("CACHE_DIRECTORY=" + f.getPath());
/* We really want to use this code, but it requires bumping up the SDK to 17 so for now if (AppConstants.Versions.feature17Plus) {
we will use reflection. See https://bugzilla.mozilla.org/show_bug.cgi?id=811763#c11
if (Build.VERSION.SDK_INT >= 17) {
android.os.UserManager um = (android.os.UserManager)context.getSystemService(Context.USER_SERVICE); android.os.UserManager um = (android.os.UserManager)context.getSystemService(Context.USER_SERVICE);
if (um != null) { if (um != null) {
putenv("MOZ_ANDROID_USER_SERIAL_NUMBER=" + um.getSerialNumberForUser(android.os.Process.myUserHandle())); putenv("MOZ_ANDROID_USER_SERIAL_NUMBER=" + um.getSerialNumberForUser(android.os.Process.myUserHandle()));
@ -173,21 +170,6 @@ public final class GeckoLoader {
Log.d(LOGTAG, "Unable to obtain user manager service on a device with SDK version " + Build.VERSION.SDK_INT); Log.d(LOGTAG, "Unable to obtain user manager service on a device with SDK version " + Build.VERSION.SDK_INT);
} }
} }
*/
try {
Object userManager = context.getSystemService("user");
if (userManager != null) {
// if userManager is non-null that means we're running on 4.2+ and so the rest of this
// should just work
Object userHandle = android.os.Process.class.getMethod("myUserHandle", (Class[])null).invoke(null);
Object userSerial = userManager.getClass().getMethod("getSerialNumberForUser", userHandle.getClass()).invoke(userManager, userHandle);
putenv("MOZ_ANDROID_USER_SERIAL_NUMBER=" + userSerial.toString());
}
} catch (Exception e) {
// Guard against any unexpected failures
Log.d(LOGTAG, "Unable to set the user serial number", e);
}
setupLocaleEnvironment(); setupLocaleEnvironment();
// We don't need this any more. // We don't need this any more.