Commit 188c0a27 authored by Richard Knoll's avatar Richard Knoll Committed by Commit Bot

Fix crash for Click to Call on pre M devices.

Android versions before M require a permission to read the call state
which we use to get metrics for Click to Call. As we do not want to add
permissions to the manifest, we won't try to log this metric on pre M
devices.

Bug: 1011767
Change-Id: I244295f57443c0831c488695b7ed2ea537e7c77c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1845007Reviewed-by: default avatarMichael van Ouwerkerk <mvanouwerkerk@chromium.org>
Commit-Queue: Richard Knoll <knollr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703356}
parent 00d5da7f
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package org.chromium.chrome.browser.sharing.click_to_call; package org.chromium.chrome.browser.sharing.click_to_call;
import android.content.Context; import android.content.Context;
import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.SystemClock; import android.os.SystemClock;
import android.telephony.PhoneStateListener; import android.telephony.PhoneStateListener;
...@@ -90,6 +91,8 @@ public class ClickToCallUma { ...@@ -90,6 +91,8 @@ public class ClickToCallUma {
@MainThread @MainThread
public static void startMetric(Context context) { public static void startMetric(Context context) {
// We do not have READ_PHONE_STATE permissions which are required pre-M.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return;
if (sListener != null) sListener.stopMetric(); if (sListener != null) sListener.stopMetric();
sListener = new CallMetricListener(context); sListener = new CallMetricListener(context);
} }
......
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