Backed out changeset 61b906754ea7 (bug 1369817)

This commit is contained in:
Sebastian Hengst 2017-08-15 18:30:34 +02:00
Родитель c5721643b5
Коммит 4e3a399cc1
1 изменённых файлов: 18 добавлений и 19 удалений

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

@ -125,6 +125,14 @@ public class WebAppActivity extends AppCompatActivity
}
private void loadManifest(String manifestPath) {
if (AppConstants.Versions.feature21Plus) {
loadManifestV21(manifestPath);
}
}
// The customisations defined in the manifest only work on Android API 21+
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void loadManifestV21(String manifestPath) {
if (TextUtils.isEmpty(manifestPath)) {
Log.e(LOGTAG, "Missing manifest");
return;
@ -134,10 +142,16 @@ public class WebAppActivity extends AppCompatActivity
final File manifestFile = new File(manifestPath);
final JSONObject manifest = FileUtils.readJSONObjectFromFile(manifestFile);
final JSONObject manifestField = manifest.getJSONObject("manifest");
final Integer color = readColorFromManifest(manifestField);
final String name = readNameFromManifest(manifestField);
final Bitmap icon = readIconFromManifest(manifest);
mScope = readScopeFromManifest(manifest, manifestPath);
final ActivityManager.TaskDescription taskDescription = (color == null)
? new ActivityManager.TaskDescription(name, icon)
: new ActivityManager.TaskDescription(name, icon, color);
if (AppConstants.Versions.feature21Plus) {
loadManifestV21(manifest, manifestField);
}
updateStatusBarColorV21(color);
setTaskDescription(taskDescription);
updateScreenOrientation(manifestField);
} catch (IOException | JSONException e) {
@ -145,21 +159,6 @@ public class WebAppActivity extends AppCompatActivity
}
}
// The customisations defined in the manifest only work on Android API 21+
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void loadManifestV21(JSONObject manifest, JSONObject manifestField) {
final Integer color = readColorFromManifest(manifestField);
final String name = readNameFromManifest(manifestField);
final Bitmap icon = readIconFromManifest(manifest);
mScope = readScopeFromManifest(manifest);
final ActivityManager.TaskDescription taskDescription = (color == null)
? new ActivityManager.TaskDescription(name, icon)
: new ActivityManager.TaskDescription(name, icon, color);
updateStatusBarColorV21(color);
setTaskDescription(taskDescription);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void updateStatusBarColorV21(final Integer themeColor) {
if (themeColor != null) {
@ -214,7 +213,7 @@ public class WebAppActivity extends AppCompatActivity
return loadIconResult.getBestBitmap(GeckoAppShell.getPreferredIconSize());
}
private Uri readScopeFromManifest(JSONObject manifest) {
private Uri readScopeFromManifest(JSONObject manifest, String manifestPath) {
final String scopeStr = manifest.optString("scope", null);
if (scopeStr == null) {
return null;