Adding flags to allow package names to be sent to support. am: e1398ea4d9 am: a95de6b96d
am: 48e12f65e8
Change-Id: I7a733267eb53c51bf60be1398ee26d156ed48c87
This commit is contained in:
@@ -22,4 +22,19 @@
|
||||
|
||||
<!-- Default data warning level in mb -->
|
||||
<integer name="default_data_warning_level_mb">2048</integer>
|
||||
|
||||
<!-- Whether to send a custom package name with the PSD. translatable="false"-->
|
||||
<bool name="config_sendPackageName">true</bool>
|
||||
|
||||
<!-- Name for the set of keys associating package names -->
|
||||
<string name="config_helpPackageNameKey" translatable="false"></string>
|
||||
|
||||
<!-- Name for the set of values of package names -->
|
||||
<string name="config_helpPackageNameValue" translatable="false"></string>
|
||||
|
||||
<!-- Intent key for the package name keys -->
|
||||
<string name="config_helpIntentExtraKey" translatable="false"></string>
|
||||
|
||||
<!-- Intent key for package name values -->
|
||||
<string name="config_helpIntentNameKey" translatable="false"></string>
|
||||
</resources>
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.Resources.Theme;
|
||||
import android.content.res.TypedArray;
|
||||
import android.net.Uri;
|
||||
@@ -145,7 +146,7 @@ public class HelpUtils {
|
||||
try {
|
||||
Intent intent = Intent.parseUri(helpUriString,
|
||||
Intent.URI_ANDROID_APP_SCHEME | Intent.URI_INTENT_SCHEME);
|
||||
addIntentParameters(context, intent, backupContext);
|
||||
addIntentParameters(context, intent, backupContext, true /* sendPackageName */);
|
||||
ComponentName component = intent.resolveActivity(context.getPackageManager());
|
||||
if (component != null) {
|
||||
return intent;
|
||||
@@ -169,11 +170,28 @@ public class HelpUtils {
|
||||
return intent;
|
||||
}
|
||||
|
||||
public static void addIntentParameters(Context context, Intent intent, String backupContext) {
|
||||
public static void addIntentParameters(Context context, Intent intent, String backupContext,
|
||||
boolean sendPackageName) {
|
||||
if (!intent.hasExtra(EXTRA_CONTEXT)) {
|
||||
// Insert some context if none exists.
|
||||
intent.putExtra(EXTRA_CONTEXT, backupContext);
|
||||
}
|
||||
|
||||
Resources resources = context.getResources();
|
||||
boolean includePackageName = resources.getBoolean(R.bool.config_sendPackageName);
|
||||
|
||||
if (sendPackageName && includePackageName) {
|
||||
String[] packageNameKey =
|
||||
{resources.getString(R.string.config_helpPackageNameKey)};
|
||||
String[] packageNameValue =
|
||||
{resources.getString(R.string.config_helpPackageNameValue)};
|
||||
String intentExtraKey =
|
||||
resources.getString(R.string.config_helpIntentExtraKey);
|
||||
String intentNameKey =
|
||||
resources.getString(R.string.config_helpIntentNameKey);
|
||||
intent.putExtra(intentExtraKey, packageNameKey);
|
||||
intent.putExtra(intentNameKey, packageNameValue);
|
||||
}
|
||||
intent.putExtra(EXTRA_THEME, 1 /* Light, dark action bar */);
|
||||
TypedArray array = context.obtainStyledAttributes(new int[]{android.R.attr.colorPrimary});
|
||||
intent.putExtra(EXTRA_PRIMARY_COLOR, array.getColor(0, 0));
|
||||
|
||||
Reference in New Issue
Block a user