Commit 327f9673 authored by Pâris MEULEMAN's avatar Pâris MEULEMAN Committed by Commit Bot

Convert IdentityServicesProvider.java to new JNI invocation convention

As found in //base/android/jni_generator/README.md, the convention of
marking method with "native" is deprecated and instead the new
convention is to mark an interface with @NativeMethods. This Converts
IdentityServicesProvider.java to the new JNI invocation convention.

Bug: 934688
Change-Id: Id080c86546ce09457f34c21a8ddf9870625b60a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1738368
Commit-Queue: Pâris Meuleman <pmeuleman@chromium.org>
Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#685504}
parent cab3cc1c
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package org.chromium.chrome.browser.signin; package org.chromium.chrome.browser.signin;
import org.chromium.base.ThreadUtils; import org.chromium.base.ThreadUtils;
import org.chromium.base.annotations.NativeMethods;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.components.signin.AccountTrackerService; import org.chromium.components.signin.AccountTrackerService;
import org.chromium.components.signin.OAuth2TokenService; import org.chromium.components.signin.OAuth2TokenService;
...@@ -18,7 +19,8 @@ public final class IdentityServicesProvider { ...@@ -18,7 +19,8 @@ public final class IdentityServicesProvider {
/** Getter for {@link IdentityManager} instance. */ /** Getter for {@link IdentityManager} instance. */
public static IdentityManager getIdentityManager() { public static IdentityManager getIdentityManager() {
ThreadUtils.assertOnUiThread(); ThreadUtils.assertOnUiThread();
IdentityManager result = nativeGetIdentityManager(Profile.getLastUsedProfile()); IdentityManager result =
IdentityServicesProviderJni.get().getIdentityManager(Profile.getLastUsedProfile());
assert result != null; assert result != null;
return result; return result;
} }
...@@ -26,27 +28,33 @@ public final class IdentityServicesProvider { ...@@ -26,27 +28,33 @@ public final class IdentityServicesProvider {
/** Getter for {@link AccountTrackerService} instance. */ /** Getter for {@link AccountTrackerService} instance. */
public static AccountTrackerService getAccountTrackerService() { public static AccountTrackerService getAccountTrackerService() {
ThreadUtils.assertOnUiThread(); ThreadUtils.assertOnUiThread();
AccountTrackerService result = nativeGetAccountTrackerService(Profile.getLastUsedProfile()); AccountTrackerService result = IdentityServicesProviderJni.get().getAccountTrackerService(
Profile.getLastUsedProfile());
assert result != null; assert result != null;
return result; return result;
} }
public static OAuth2TokenService getOAuth2TokenService() { public static OAuth2TokenService getOAuth2TokenService() {
ThreadUtils.assertOnUiThread(); ThreadUtils.assertOnUiThread();
OAuth2TokenService result = nativeGetOAuth2TokenService(Profile.getLastUsedProfile()); OAuth2TokenService result = IdentityServicesProviderJni.get().getOAuth2TokenService(
Profile.getLastUsedProfile());
assert result != null; assert result != null;
return result; return result;
} }
public static SigninManager getSigninManager() { public static SigninManager getSigninManager() {
ThreadUtils.assertOnUiThread(); ThreadUtils.assertOnUiThread();
SigninManager result = nativeGetSigninManager(Profile.getLastUsedProfile()); SigninManager result =
IdentityServicesProviderJni.get().getSigninManager(Profile.getLastUsedProfile());
assert result != null; assert result != null;
return result; return result;
} }
private static native IdentityManager nativeGetIdentityManager(Profile profile); @NativeMethods
private static native AccountTrackerService nativeGetAccountTrackerService(Profile profile); interface Natives {
private static native OAuth2TokenService nativeGetOAuth2TokenService(Profile profile); public IdentityManager getIdentityManager(Profile profile);
private static native SigninManager nativeGetSigninManager(Profile profile); public AccountTrackerService getAccountTrackerService(Profile profile);
public OAuth2TokenService getOAuth2TokenService(Profile profile);
public SigninManager getSigninManager(Profile profile);
}
} }
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