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 {
return true;
}
if (ExternalAuthUtils.getInstance().isGoogleSigned(
ContextUtils.getApplicationContext(),
ApiCompatibilityUtils.getCreatorPackage(token))) {
return true;
}
......
......@@ -90,34 +90,12 @@ public class ExternalAuthUtils {
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.
* @return whether the currently running application is signed with Google keys.
*/
public boolean isChromeGoogleSigned() {
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);
}
......@@ -149,7 +127,7 @@ public class ExternalAuthUtils {
for (String packageName : callingPackages) {
if (!TextUtils.isEmpty(packageToMatch) && !packageName.equals(packageToMatch)) continue;
matchFound = true;
if ((shouldBeGoogleSigned && !isGoogleSigned(context, packageName))
if ((shouldBeGoogleSigned && !isGoogleSigned(packageName))
|| (shouldBeSystem && !isSystemBuild(pm, packageName))) {
return false;
}
......@@ -263,7 +241,7 @@ public class ExternalAuthUtils {
public boolean canUseFirstPartyGooglePlayServices(
Context context, UserRecoverableErrorHandler userRecoverableErrorHandler) {
return canUseGooglePlayServices(context, userRecoverableErrorHandler)
&& isChromeGoogleSigned(context);
&& isChromeGoogleSigned();
}
/**
......
......@@ -36,8 +36,7 @@ public class ChromeGoogleApiClientImpl implements ChromeGoogleApiClient {
boolean requireFirstPartyBuild) {
mApplicationContext = context.getApplicationContext();
mClient = client;
if (requireFirstPartyBuild
&& !ExternalAuthUtils.getInstance().isChromeGoogleSigned(mApplicationContext)) {
if (requireFirstPartyBuild && !ExternalAuthUtils.getInstance().isChromeGoogleSigned()) {
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