Commit 571af98e authored by Shimi Zhang's avatar Shimi Zhang Committed by Commit Bot

Revert "Reland "Android: Add extra fields related to resources to crash reports.""

This reverts commit 0d9dad32.

Reason for revert: This is causing some failure on builders, please see
http://crbug.com/827445 for more info.

Original change's description:
> Reland "Android: Add extra fields related to resources to crash reports."
>
> This is a reland of 3e261e9b.
>
> Reason for reland:
>   * Fixed deps order (caused flaky compile errors)
>   * Fixed cronet apk by removing resources dep
>
> Original change's description:
> > Android: Add extra fields related to resources to crash reports.
> >
> > This CL adds two fields to Android crash reports. Specifically:
> > 1. custom_themes: Whether or not the user has apps installed for using
> > custom themes. This should help debug obscure resources related
> > crashes.
> > 2. resources_version: The product version as stored in resources.arsc.
> > This should help us detect if we tried to load resources from the old
> > apk during an update.
> >
> > Bug: 820591
> > Change-Id: I1e2b36ec5640bb1376f83452851eaa5319d0f32f
> > Reviewed-on: https://chromium-review.googlesource.com/969597
> > Commit-Queue: Eric Stevenson <estevenson@chromium.org>
> > Reviewed-by: Lei Zhang <thestig@chromium.org>
> > Reviewed-by: agrieve <agrieve@chromium.org>
> > Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#545798}
>
> Bug: 820591
> Change-Id: Id30e79ed508dbecc1b277a0450ec7784120e2efe
> tbr: yfriedman@chromium.org
> Reviewed-on: https://chromium-review.googlesource.com/981156
> Commit-Queue: Eric Stevenson <estevenson@chromium.org>
> Reviewed-by: agrieve <agrieve@chromium.org>
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#546211}

TBR=yfriedman@chromium.org,thestig@chromium.org,agrieve@chromium.org,estevenson@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 820591
Change-Id: Iccdbb25f2d9698df6b37cdac96df9420aa333789
Reviewed-on: https://chromium-review.googlesource.com/987273
Commit-Queue: Shimi Zhang <ctzsm@chromium.org>
Reviewed-by: default avatarShimi Zhang <ctzsm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547097}
parent 84ea9200
...@@ -73,9 +73,7 @@ BuildInfo::BuildInfo(const std::vector<std::string>& params) ...@@ -73,9 +73,7 @@ BuildInfo::BuildInfo(const std::vector<std::string>& params)
installer_package_name_(StrDupParam(params, 16)), installer_package_name_(StrDupParam(params, 16)),
abi_name_(StrDupParam(params, 17)), abi_name_(StrDupParam(params, 17)),
firebase_app_id_(StrDupParam(params, 18)), firebase_app_id_(StrDupParam(params, 18)),
custom_themes_(StrDupParam(params, 19)), extracted_file_suffix_(params[19]),
resources_version_(StrDupParam(params, 20)),
extracted_file_suffix_(params[21]),
java_exception_info_(NULL) {} java_exception_info_(NULL) {}
// static // static
......
...@@ -103,10 +103,6 @@ class BASE_EXPORT BuildInfo { ...@@ -103,10 +103,6 @@ class BASE_EXPORT BuildInfo {
// Will be empty string if no app id is assigned. // Will be empty string if no app id is assigned.
const char* firebase_app_id() const { return firebase_app_id_; } const char* firebase_app_id() const { return firebase_app_id_; }
const char* custom_themes() const { return custom_themes_; }
const char* resources_version() const { return resources_version_; }
const char* build_type() const { const char* build_type() const {
return build_type_; return build_type_;
} }
...@@ -159,8 +155,6 @@ class BASE_EXPORT BuildInfo { ...@@ -159,8 +155,6 @@ class BASE_EXPORT BuildInfo {
const char* const installer_package_name_; const char* const installer_package_name_;
const char* const abi_name_; const char* const abi_name_;
const char* const firebase_app_id_; const char* const firebase_app_id_;
const char* const custom_themes_;
const char* const resources_version_;
// Not needed by breakpad. // Not needed by breakpad.
const std::string extracted_file_suffix_; const std::string extracted_file_suffix_;
// This is set via set_java_exception_info, not at constructor time. // This is set via set_java_exception_info, not at constructor time.
......
...@@ -45,10 +45,6 @@ public class BuildInfo { ...@@ -45,10 +45,6 @@ public class BuildInfo {
public final String androidBuildFingerprint; public final String androidBuildFingerprint;
/** A string that is different each time the apk changes. */ /** A string that is different each time the apk changes. */
public final String extractedFileSuffix; public final String extractedFileSuffix;
/** Whether or not the device has apps installed for using custom themes. */
public final String customThemes;
/** Product version as stored in Android resources. */
public final String resourcesVersion;
private static class Holder { private static BuildInfo sInstance = new BuildInfo(); } private static class Holder { private static BuildInfo sInstance = new BuildInfo(); }
...@@ -63,7 +59,7 @@ public class BuildInfo { ...@@ -63,7 +59,7 @@ public class BuildInfo {
buildInfo.packageName, String.valueOf(buildInfo.versionCode), buildInfo.versionName, buildInfo.packageName, String.valueOf(buildInfo.versionCode), buildInfo.versionName,
buildInfo.androidBuildFingerprint, buildInfo.gmsVersionCode, buildInfo.androidBuildFingerprint, buildInfo.gmsVersionCode,
buildInfo.installerPackageName, buildInfo.abiString, BuildConfig.FIREBASE_APP_ID, buildInfo.installerPackageName, buildInfo.abiString, BuildConfig.FIREBASE_APP_ID,
buildInfo.customThemes, buildInfo.resourcesVersion, buildInfo.extractedFileSuffix, buildInfo.extractedFileSuffix,
}; };
} }
...@@ -114,31 +110,6 @@ public class BuildInfo { ...@@ -114,31 +110,6 @@ public class BuildInfo {
gmsVersionCode = gmsPackageInfo != null ? String.valueOf(gmsPackageInfo.versionCode) gmsVersionCode = gmsPackageInfo != null ? String.valueOf(gmsPackageInfo.versionCode)
: "gms versionCode not available."; : "gms versionCode not available.";
String hasCustomThemes = "true";
try {
// Substratum is a theme engine that enables users to use custom themes provided
// by theme apps. Sometimes these can cause crashs if not installed correctly.
// These crashes can be difficult to debug, so knowing if the theme manager is
// present on the device is useful (http://crbug.com/820591).
pm.getPackageInfo("projekt.substratum", 0);
} catch (NameNotFoundException e) {
hasCustomThemes = "false";
}
customThemes = hasCustomThemes;
String currentResourcesVersion;
try {
// This value can be compared with the actual product version to determine if
// corrupted resources were the cause of a crash. This can happen if the app
// loads resources from the outdated package during an update
// (http://crbug.com/820591).
currentResourcesVersion = ContextUtils.getApplicationContext().getString(
BuildConfig.R_STRING_PRODUCT_VERSION);
} catch (Exception e) {
currentResourcesVersion = "Not found";
}
resourcesVersion = currentResourcesVersion;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
abiString = TextUtils.join(", ", Build.SUPPORTED_ABIS); abiString = TextUtils.join(", ", Build.SUPPORTED_ABIS);
} else { } else {
......
...@@ -57,14 +57,4 @@ public class BuildConfig { ...@@ -57,14 +57,4 @@ public class BuildConfig {
#else #else
public static MAYBE_FINAL String[] UNCOMPRESSED_LOCALES = {}; public static MAYBE_FINAL String[] UNCOMPRESSED_LOCALES = {};
#endif #endif
// The ID of the android string resource that stores the product version.
// This layer of indirection is necessary to make the resource dependency
// optional for android_apk targets/base_java (ex. for cronet).
#if defined(_RESOURCES_VERSION_VARIABLE)
public static MAYBE_FINAL int R_STRING_PRODUCT_VERSION = _RESOURCES_VERSION_VARIABLE;
#else
// Default value, do not use.
public static MAYBE_FINAL int R_STRING_PRODUCT_VERSION = 0;
#endif
} }
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<string name="{{resource_name}}" translatable="false" tools:ignore="UnusedResources">{{product_version}}</string>
</resources>
...@@ -1714,11 +1714,6 @@ if (enable_java_templates) { ...@@ -1714,11 +1714,6 @@ if (enable_java_templates) {
if (defined(invoker.firebase_app_id)) { if (defined(invoker.firebase_app_id)) {
defines += [ "_FIREBASE_APP_ID=${invoker.firebase_app_id}" ] defines += [ "_FIREBASE_APP_ID=${invoker.firebase_app_id}" ]
} }
if (defined(invoker.resources_version_variable)) {
defines += [
"_RESOURCES_VERSION_VARIABLE=${invoker.resources_version_variable}",
]
}
} }
} }
} }
...@@ -2033,34 +2028,6 @@ if (enable_java_templates) { ...@@ -2033,34 +2028,6 @@ if (enable_java_templates) {
"$_base_path.resources.main-dex-proguard.txt" "$_base_path.resources.main-dex-proguard.txt"
} }
_generated_proguard_config = "$_base_path.resources.proguard.txt" _generated_proguard_config = "$_base_path.resources.proguard.txt"
if (_generate_buildconfig_java) {
_version_resources_target = "${_template_name}__version_resources"
_version_resources_target_tmpl = "${_version_resources_target}_template"
_version_res_dir = "$target_gen_dir/$_template_name/res/"
_version_res_file = "$_version_res_dir/values/version_strings.xml"
_product_version_resource_name = "product_version"
jinja_template(_version_resources_target_tmpl) {
input =
"//build/android/templates/res/values/version_strings.xml.template"
output = _version_res_file
variables = [
"product_version=$_version_name",
"resource_name=$_product_version_resource_name",
]
}
android_resources(_version_resources_target) {
deps = [
":$_version_resources_target_tmpl",
]
resource_dirs = []
generated_resource_dirs = [ _version_res_dir ]
generated_resource_files = [ _version_res_file ]
custom_package = "org.chromium.base"
}
_deps += [ ":$_version_resources_target" ]
}
_compile_resources_target = "${_template_name}__compile_resources" _compile_resources_target = "${_template_name}__compile_resources"
compile_resources(_compile_resources_target) { compile_resources(_compile_resources_target) {
forward_variables_from(invoker, forward_variables_from(invoker,
...@@ -2195,9 +2162,6 @@ if (enable_java_templates) { ...@@ -2195,9 +2162,6 @@ if (enable_java_templates) {
use_final_fields = true use_final_fields = true
build_config = _build_config build_config = _build_config
enable_multidex = _enable_multidex enable_multidex = _enable_multidex
resources_version_variable =
"org.chromium.base.R.string.${_product_version_resource_name}"
deps = [ deps = [
":$_build_config_target", ":$_build_config_target",
] ]
......
...@@ -49,8 +49,6 @@ public class PureJavaExceptionReporter { ...@@ -49,8 +49,6 @@ public class PureJavaExceptionReporter {
public static final String EXCEPTION_INFO = "exception_info"; public static final String EXCEPTION_INFO = "exception_info";
public static final String PROCESS_TYPE = "ptype"; public static final String PROCESS_TYPE = "ptype";
public static final String EARLY_JAVA_EXCEPTION = "early_java_exception"; public static final String EARLY_JAVA_EXCEPTION = "early_java_exception";
public static final String CUSTOM_THEMES = "custom_themes";
public static final String RESOURCES_VERSION = "resources_version";
private static final String CRASH_DUMP_DIR = "Crash Reports"; private static final String CRASH_DUMP_DIR = "Crash Reports";
private static final String FILE_PREFIX = "chromium-browser-minidump-"; private static final String FILE_PREFIX = "chromium-browser-minidump-";
...@@ -139,8 +137,6 @@ public class PureJavaExceptionReporter { ...@@ -139,8 +137,6 @@ public class PureJavaExceptionReporter {
addPairedString(PACKAGE, addPairedString(PACKAGE,
String.format("%s v%s (%s)", BuildConfig.FIREBASE_APP_ID, buildInfo.versionCode, String.format("%s v%s (%s)", BuildConfig.FIREBASE_APP_ID, buildInfo.versionCode,
buildInfo.versionName)); buildInfo.versionName));
addPairedString(CUSTOM_THEMES, buildInfo.customThemes);
addPairedString(RESOURCES_VERSION, buildInfo.resourcesVersion);
addString(mBoundary); addString(mBoundary);
} }
......
...@@ -1713,8 +1713,6 @@ void HandleCrashDump(const BreakpadInfo& info) { ...@@ -1713,8 +1713,6 @@ void HandleCrashDump(const BreakpadInfo& info) {
static const char brand[] = "brand"; static const char brand[] = "brand";
static const char board[] = "board"; static const char board[] = "board";
static const char exception_info[] = "exception_info"; static const char exception_info[] = "exception_info";
static const char custom_themes[] = "custom_themes";
static const char resources_version[] = "resources_version";
base::android::BuildInfo* android_build_info = base::android::BuildInfo* android_build_info =
base::android::BuildInfo::GetInstance(); base::android::BuildInfo::GetInstance();
...@@ -1740,11 +1738,6 @@ void HandleCrashDump(const BreakpadInfo& info) { ...@@ -1740,11 +1738,6 @@ void HandleCrashDump(const BreakpadInfo& info) {
writer.AddBoundary(); writer.AddBoundary();
writer.AddPairString(abi_name, android_build_info->abi_name()); writer.AddPairString(abi_name, android_build_info->abi_name());
writer.AddBoundary(); writer.AddBoundary();
writer.AddPairString(custom_themes, android_build_info->custom_themes());
writer.AddBoundary();
writer.AddPairString(resources_version,
android_build_info->resources_version());
writer.AddBoundary();
WriteAndroidPackage(writer, android_build_info); WriteAndroidPackage(writer, android_build_info);
writer.AddBoundary(); writer.AddBoundary();
if (android_build_info->java_exception_info() != nullptr) { if (android_build_info->java_exception_info() != nullptr) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment