Android Chromoting: Use explicit intent for opening Feedback screen.

Using bindService() with implicit intents is unsafe, and will be
prohibited in L once the targetSdkVersion gets bumped.

Also check that the intent resolves before using it, to avoid
crashing the app.

BUG=399418
TEST=Pressing the FEEDBACK button shows Feedback screen.

Review URL: https://codereview.chromium.org/451543002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288130 0039d316-1c4b-4281-b951-d872f2087c98
parent 01b79894
......@@ -33,6 +33,11 @@ import org.chromium.ui.UiUtils;
public class HelpActivity extends Activity {
private static final String PLAY_STORE_URL = "market://details?id=";
private static final String FEEDBACK_PACKAGE = "com.google.android.gms";
private static final String FEEDBACK_CLASS =
"com.google.android.gms.feedback.LegacyBugReportService";
/**
* Maximum dimension for the screenshot to be sent to the Send Feedback handler. This size
* ensures the size of bitmap < 1MB, which is a requirement of the handler.
......@@ -62,6 +67,12 @@ public class HelpActivity extends Activity {
private void sendFeedback() {
Intent intent = new Intent(Intent.ACTION_BUG_REPORT);
intent.setComponent(new ComponentName(FEEDBACK_PACKAGE, FEEDBACK_CLASS));
if (getPackageManager().resolveService(intent, 0) == null) {
Log.e("help", "Unable to resolve Feedback service.");
return;
}
ServiceConnection conn = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
......
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