diff options
author | Eric Erfanian <erfanian@google.com> | 2017-07-25 09:36:19 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-07-25 16:40:56 +0000 |
commit | 9b4d9bca30470c65f3c97f965d1f21523a631299 (patch) | |
tree | a69760004caa7e4dc648f5140e2467c215e1a2c5 /java/com/android/dialer/constants | |
parent | 3ab483433549d9dbc9b47cd5ad1b1d60b885a01a (diff) |
Move ContactPhotoManager code and related utilties out of contacts/common.
Bug: 37208805
Test: compiler, on device
PiperOrigin-RevId: 162268272
Change-Id: I98d63d063b9a4dff6a1b1b7462378ef7d0139bd2
Diffstat (limited to 'java/com/android/dialer/constants')
3 files changed, 27 insertions, 0 deletions
diff --git a/java/com/android/dialer/constants/Constants.java b/java/com/android/dialer/constants/Constants.java index 076393e63..f9d07e31d 100644 --- a/java/com/android/dialer/constants/Constants.java +++ b/java/com/android/dialer/constants/Constants.java @@ -16,6 +16,7 @@ package com.android.dialer.constants; +import android.content.Context; import android.support.annotation.NonNull; import com.android.dialer.common.Assert; import com.android.dialer.proguard.UsedByReflection; @@ -56,5 +57,7 @@ public abstract class Constants { @NonNull public abstract String getAnnotatedCallLogProviderAuthority(); + public abstract String getUserAgent(Context context); + protected Constants() {} } diff --git a/java/com/android/dialer/constants/aospdialer/ConstantsImpl.java b/java/com/android/dialer/constants/aospdialer/ConstantsImpl.java index 1111732f3..38fd24b8a 100644 --- a/java/com/android/dialer/constants/aospdialer/ConstantsImpl.java +++ b/java/com/android/dialer/constants/aospdialer/ConstantsImpl.java @@ -16,6 +16,7 @@ package com.android.dialer.constants; +import android.content.Context; import android.support.annotation.NonNull; import com.android.dialer.proguard.UsedByReflection; @@ -40,4 +41,9 @@ public class ConstantsImpl extends Constants { public String getAnnotatedCallLogProviderAuthority() { return "com.android.dialer.annotatedcalllog"; } + + @Override + public String getUserAgent(Context context) { + return null; + } } diff --git a/java/com/android/dialer/constants/googledialer/ConstantsImpl.java b/java/com/android/dialer/constants/googledialer/ConstantsImpl.java index 28d8b2514..e151344ba 100644 --- a/java/com/android/dialer/constants/googledialer/ConstantsImpl.java +++ b/java/com/android/dialer/constants/googledialer/ConstantsImpl.java @@ -16,6 +16,9 @@ package com.android.dialer.constants; +import android.content.Context; +import android.content.pm.PackageManager; +import android.os.Build; import android.support.annotation.NonNull; import com.android.dialer.proguard.UsedByReflection; @@ -40,4 +43,19 @@ public class ConstantsImpl extends Constants { public String getAnnotatedCallLogProviderAuthority() { return "com.google.android.dialer.annotatedcalllog"; } + + @Override + public String getUserAgent(Context context) { + StringBuilder userAgent = new StringBuilder("GoogleDialer "); + try { + String versionName = + context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; + userAgent.append(versionName).append(" "); + } catch (PackageManager.NameNotFoundException e) { + // ignore + } + userAgent.append(Build.FINGERPRINT); + + return userAgent.toString(); + } } |