Commit fd898973 authored by paulmiller's avatar paulmiller Committed by Commit bot

Remove vestigial Context arguments in ExternalAuthUtils, part 3/3

BUG=709208

Review-Url: https://codereview.chromium.org/2806023003
Cr-Commit-Position: refs/heads/master@{#463034}
parent 0f6eda87
...@@ -781,7 +781,6 @@ public class IntentHandler { ...@@ -781,7 +781,6 @@ public class IntentHandler {
return true; return true;
} }
if (ExternalAuthUtils.getInstance().isGoogleSigned( if (ExternalAuthUtils.getInstance().isGoogleSigned(
ContextUtils.getApplicationContext(),
ApiCompatibilityUtils.getCreatorPackage(token))) { ApiCompatibilityUtils.getCreatorPackage(token))) {
return true; return true;
} }
......
...@@ -90,34 +90,12 @@ public class ExternalAuthUtils { ...@@ -90,34 +90,12 @@ public class ExternalAuthUtils {
return true; return true;
} }
// TODO(paulmiller): Remove; replaced by no-argument isChromeGoogleSigned().
/**
* Returns whether the current build of Chrome is a Google-signed package.
*
* @param context the current context.
* @return whether the currently running application is signed with Google keys.
*/
public boolean isChromeGoogleSigned(Context context) {
return isGoogleSigned(context, context.getPackageName());
}
/** /**
* Returns whether the current build of Chrome is a Google-signed package. * Returns whether the current build of Chrome is a Google-signed package.
* @return whether the currently running application is signed with Google keys. * @return whether the currently running application is signed with Google keys.
*/ */
public boolean isChromeGoogleSigned() { public boolean isChromeGoogleSigned() {
String packageName = ContextUtils.getApplicationContext().getPackageName(); String packageName = ContextUtils.getApplicationContext().getPackageName();
return isGoogleSigned(null, packageName);
}
// TODO(paulmiller): Remove; replaced by isGoogleSigned(String).
/**
* Returns whether the call is originating from a Google-signed package.
* @param appContext the current context.
* @param packageName The package name to inquire about.
*/
public boolean isGoogleSigned(Context context, String packageName) {
// This is overridden in a subclass.
return isGoogleSigned(packageName); return isGoogleSigned(packageName);
} }
...@@ -149,7 +127,7 @@ public class ExternalAuthUtils { ...@@ -149,7 +127,7 @@ public class ExternalAuthUtils {
for (String packageName : callingPackages) { for (String packageName : callingPackages) {
if (!TextUtils.isEmpty(packageToMatch) && !packageName.equals(packageToMatch)) continue; if (!TextUtils.isEmpty(packageToMatch) && !packageName.equals(packageToMatch)) continue;
matchFound = true; matchFound = true;
if ((shouldBeGoogleSigned && !isGoogleSigned(context, packageName)) if ((shouldBeGoogleSigned && !isGoogleSigned(packageName))
|| (shouldBeSystem && !isSystemBuild(pm, packageName))) { || (shouldBeSystem && !isSystemBuild(pm, packageName))) {
return false; return false;
} }
...@@ -263,7 +241,7 @@ public class ExternalAuthUtils { ...@@ -263,7 +241,7 @@ public class ExternalAuthUtils {
public boolean canUseFirstPartyGooglePlayServices( public boolean canUseFirstPartyGooglePlayServices(
Context context, UserRecoverableErrorHandler userRecoverableErrorHandler) { Context context, UserRecoverableErrorHandler userRecoverableErrorHandler) {
return canUseGooglePlayServices(context, userRecoverableErrorHandler) return canUseGooglePlayServices(context, userRecoverableErrorHandler)
&& isChromeGoogleSigned(context); && isChromeGoogleSigned();
} }
/** /**
......
...@@ -36,8 +36,7 @@ public class ChromeGoogleApiClientImpl implements ChromeGoogleApiClient { ...@@ -36,8 +36,7 @@ public class ChromeGoogleApiClientImpl implements ChromeGoogleApiClient {
boolean requireFirstPartyBuild) { boolean requireFirstPartyBuild) {
mApplicationContext = context.getApplicationContext(); mApplicationContext = context.getApplicationContext();
mClient = client; mClient = client;
if (requireFirstPartyBuild if (requireFirstPartyBuild && !ExternalAuthUtils.getInstance().isChromeGoogleSigned()) {
&& !ExternalAuthUtils.getInstance().isChromeGoogleSigned(mApplicationContext)) {
throw new IllegalStateException("GoogleApiClient requires first-party build"); throw new IllegalStateException("GoogleApiClient requires first-party build");
} }
} }
......
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