Add @NullMarked to a a few files in base, cc, content, ui
Bug: 389129271 Change-Id: Ia204a2336bff8ec4446b7ca3aa34798c3906b22f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6262628 Auto-Submit: Andrew Grieve <agrieve@chromium.org> Commit-Queue: Mohamed Heikal <mheikal@chromium.org> Owners-Override: Andrew Grieve <agrieve@chromium.org> Reviewed-by: Mohamed Heikal <mheikal@chromium.org> Cr-Commit-Position: refs/heads/main@{#1419928}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
c57e52b485
commit
5535e95d4f
base/android/java/src/org/chromium/base
cc/input/android/java/src/org/chromium/cc/input
content/public/android/java/src/org/chromium
ui/android/java/src/org/chromium/ui
@ -12,8 +12,11 @@ import org.jni_zero.CalledByNative;
|
||||
import org.jni_zero.JNINamespace;
|
||||
import org.jni_zero.NativeMethods;
|
||||
|
||||
import org.chromium.build.annotations.NullMarked;
|
||||
|
||||
/** AndroidInfo is a utility class to access Android's Build information specific data. */
|
||||
@JNINamespace("base::android::android_info")
|
||||
@NullMarked
|
||||
public final class AndroidInfo {
|
||||
private static final String TAG = "AndroidInfo";
|
||||
|
||||
|
@ -19,6 +19,7 @@ import org.jni_zero.NativeMethods;
|
||||
|
||||
import org.chromium.base.version_info.VersionInfo;
|
||||
import org.chromium.build.BuildConfig;
|
||||
import org.chromium.build.annotations.NullMarked;
|
||||
import org.chromium.build.annotations.Nullable;
|
||||
|
||||
/**
|
||||
@ -30,13 +31,14 @@ import org.chromium.build.annotations.Nullable;
|
||||
* regressions.
|
||||
*/
|
||||
@JNINamespace("base::android::apk_info")
|
||||
@NullMarked
|
||||
public final class ApkInfo {
|
||||
private static final String TAG = "ApkInfo";
|
||||
|
||||
private static boolean sInitialized;
|
||||
private static @Nullable PackageInfo sBrowserPackageInfo;
|
||||
|
||||
private ApplicationInfo mBrowserApplicationInfo;
|
||||
private final ApplicationInfo mBrowserApplicationInfo;
|
||||
|
||||
/**
|
||||
* The package name of the host app which has loaded WebView, retrieved from the application
|
||||
@ -75,7 +77,7 @@ public final class ApkInfo {
|
||||
/** Product version as stored in Android resources. */
|
||||
private final String mResourcesVersion;
|
||||
|
||||
private static volatile ApkInfo sInstance;
|
||||
private static volatile @Nullable ApkInfo sInstance;
|
||||
|
||||
private static final Object CREATION_LOCK = new Object();
|
||||
|
||||
@ -238,15 +240,14 @@ public final class ApkInfo {
|
||||
// In the case of the SDK Runtime, we would like to retrieve the package name loading the
|
||||
// SDK.
|
||||
String appInstalledPackageName = appContextPackageName;
|
||||
ApplicationInfo appInfo = appContext.getApplicationInfo();
|
||||
|
||||
if (hostInformationProvided) {
|
||||
mHostPackageName = providedHostPackageName;
|
||||
mHostPackageLabel = providedHostPackageLabel;
|
||||
mHostVersionCode = providedHostVersionCode;
|
||||
mVersionName = providedPackageVersionName;
|
||||
mPackageName = providedPackageName;
|
||||
|
||||
mBrowserApplicationInfo = appContext.getApplicationInfo();
|
||||
mHostPackageName = assumeNonNull(providedHostPackageName);
|
||||
mHostPackageLabel = assumeNonNull(providedHostPackageLabel);
|
||||
mHostVersionCode = assumeNonNull(providedHostVersionCode);
|
||||
mVersionName = assumeNonNull(providedPackageVersionName);
|
||||
mPackageName = assumeNonNull(providedPackageName);
|
||||
} else {
|
||||
// The SDK Qualified package name will retrieve the same information as
|
||||
// appInstalledPackageName but prefix it with the SDK Sandbox process so that we can
|
||||
@ -272,7 +273,6 @@ public final class ApkInfo {
|
||||
}
|
||||
}
|
||||
|
||||
ApplicationInfo appInfo = appContext.getApplicationInfo();
|
||||
mHostPackageName = sdkQualifiedName;
|
||||
mHostPackageLabel = nullToEmpty(pm.getApplicationLabel(appInfo));
|
||||
|
||||
@ -282,15 +282,16 @@ public final class ApkInfo {
|
||||
mHostVersionCode = PackageUtils.packageVersionCode(pi);
|
||||
mPackageName = sBrowserPackageInfo.packageName;
|
||||
mVersionName = nullToEmpty(sBrowserPackageInfo.versionName);
|
||||
mBrowserApplicationInfo = sBrowserPackageInfo.applicationInfo;
|
||||
appInfo = sBrowserPackageInfo.applicationInfo;
|
||||
sBrowserPackageInfo = null;
|
||||
} else {
|
||||
mPackageName = appContextPackageName;
|
||||
mHostVersionCode = BuildConfig.VERSION_CODE;
|
||||
mVersionName = VersionInfo.getProductVersion();
|
||||
mBrowserApplicationInfo = appInfo;
|
||||
}
|
||||
}
|
||||
assert appInfo != null;
|
||||
mBrowserApplicationInfo = appInfo;
|
||||
|
||||
mInstallerPackageName = nullToEmpty(pm.getInstallerPackageName(appInstalledPackageName));
|
||||
|
||||
|
@ -24,10 +24,12 @@ import org.jni_zero.JniType;
|
||||
import org.jni_zero.NativeMethods;
|
||||
|
||||
import org.chromium.build.BuildConfig;
|
||||
import org.chromium.build.annotations.NullMarked;
|
||||
import org.chromium.build.annotations.Nullable;
|
||||
|
||||
/** DeviceInfo is a utility class to access the device-related information. */
|
||||
@JNINamespace("base::android::device_info")
|
||||
@NullMarked
|
||||
public final class DeviceInfo {
|
||||
private static final String TAG = "DeviceInfo";
|
||||
|
||||
@ -58,7 +60,7 @@ public final class DeviceInfo {
|
||||
private final int mVulkanDeqpLevel;
|
||||
|
||||
@GuardedBy("CREATION_LOCK")
|
||||
private static DeviceInfo sInstance;
|
||||
private static @Nullable DeviceInfo sInstance;
|
||||
|
||||
private static final Object CREATION_LOCK = new Object();
|
||||
|
||||
|
@ -8,8 +8,11 @@ import com.google.errorprone.annotations.DoNotMock;
|
||||
|
||||
import org.jni_zero.CalledByNative;
|
||||
|
||||
import org.chromium.build.annotations.NullMarked;
|
||||
|
||||
/** Java counterpart to the native cc::BrowserControlsOffsetTagModifications. */
|
||||
@DoNotMock("This is a simple value object.")
|
||||
@NullMarked
|
||||
public final class BrowserControlsOffsetTagModifications {
|
||||
private final BrowserControlsOffsetTags mTags;
|
||||
|
||||
|
@ -8,12 +8,16 @@ import com.google.errorprone.annotations.DoNotMock;
|
||||
|
||||
import org.jni_zero.CalledByNative;
|
||||
|
||||
import org.chromium.build.annotations.NullMarked;
|
||||
import org.chromium.build.annotations.Nullable;
|
||||
|
||||
/** Java counterpart to the native cc::BrowserControlsOffsetTags. */
|
||||
@DoNotMock("This is a simple value object.")
|
||||
@NullMarked
|
||||
public final class BrowserControlsOffsetTags {
|
||||
private final OffsetTag mTopControlsOffsetTag;
|
||||
private final OffsetTag mContentOffsetTag;
|
||||
private final OffsetTag mBottomControlsOffsetTag;
|
||||
private final @Nullable OffsetTag mTopControlsOffsetTag;
|
||||
private final @Nullable OffsetTag mContentOffsetTag;
|
||||
private final @Nullable OffsetTag mBottomControlsOffsetTag;
|
||||
|
||||
public BrowserControlsOffsetTags() {
|
||||
mTopControlsOffsetTag = OffsetTag.createRandom();
|
||||
@ -22,7 +26,9 @@ public final class BrowserControlsOffsetTags {
|
||||
}
|
||||
|
||||
public BrowserControlsOffsetTags(
|
||||
OffsetTag topControls, OffsetTag content, OffsetTag bottomControls) {
|
||||
@Nullable OffsetTag topControls,
|
||||
@Nullable OffsetTag content,
|
||||
@Nullable OffsetTag bottomControls) {
|
||||
mTopControlsOffsetTag = topControls;
|
||||
mContentOffsetTag = content;
|
||||
mBottomControlsOffsetTag = bottomControls;
|
||||
@ -41,17 +47,17 @@ public final class BrowserControlsOffsetTags {
|
||||
}
|
||||
|
||||
@CalledByNative
|
||||
public OffsetTag getBottomControlsOffsetTag() {
|
||||
public @Nullable OffsetTag getBottomControlsOffsetTag() {
|
||||
return mBottomControlsOffsetTag;
|
||||
}
|
||||
|
||||
@CalledByNative
|
||||
public OffsetTag getContentOffsetTag() {
|
||||
public @Nullable OffsetTag getContentOffsetTag() {
|
||||
return mContentOffsetTag;
|
||||
}
|
||||
|
||||
@CalledByNative
|
||||
public OffsetTag getTopControlsOffsetTag() {
|
||||
public @Nullable OffsetTag getTopControlsOffsetTag() {
|
||||
return mTopControlsOffsetTag;
|
||||
}
|
||||
}
|
||||
|
@ -867,7 +867,7 @@ public class WebContentsImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStylusWritingHandler(StylusWritingHandler stylusWritingHandler) {
|
||||
public void setStylusWritingHandler(@Nullable StylusWritingHandler stylusWritingHandler) {
|
||||
mStylusWritingHandler = stylusWritingHandler;
|
||||
if (mNativeWebContentsAndroid == 0) return;
|
||||
WebContentsImplJni.get()
|
||||
|
@ -452,14 +452,13 @@ public interface WebContents extends Parcelable {
|
||||
*
|
||||
* @param stylusWritingHandler the object that implements StylusWritingHandler interface.
|
||||
*/
|
||||
void setStylusWritingHandler(StylusWritingHandler stylusWritingHandler);
|
||||
void setStylusWritingHandler(@Nullable StylusWritingHandler stylusWritingHandler);
|
||||
|
||||
/**
|
||||
* @return {@link StylusWritingImeCallback} which is used to implement the IME functionality for
|
||||
* the Stylus handwriting feature.
|
||||
*/
|
||||
@Nullable
|
||||
StylusWritingImeCallback getStylusWritingImeCallback();
|
||||
@Nullable StylusWritingImeCallback getStylusWritingImeCallback();
|
||||
|
||||
/**
|
||||
* Returns {@link EventForwarder} which is used to forward input/view events to native content
|
||||
@ -522,8 +521,7 @@ public interface WebContents extends Parcelable {
|
||||
* the rectangle is meaningless. Will return null if there is no such video. Fullscreen videos
|
||||
* may take a moment to register.
|
||||
*/
|
||||
@Nullable
|
||||
Rect getFullscreenVideoSize();
|
||||
@Nullable Rect getFullscreenVideoSize();
|
||||
|
||||
/**
|
||||
* Notifies the WebContents about the new persistent video status. It should be called whenever
|
||||
|
@ -8,34 +8,38 @@ import com.google.errorprone.annotations.DoNotMock;
|
||||
|
||||
import org.jni_zero.CalledByNative;
|
||||
|
||||
import org.chromium.build.annotations.NullMarked;
|
||||
import org.chromium.build.annotations.Nullable;
|
||||
|
||||
/** Java counterpart to the native ui::android::BrowserControlsOffsetTagConstraints. */
|
||||
@DoNotMock("This is a simple value object.")
|
||||
@NullMarked
|
||||
public final class BrowserControlsOffsetTagConstraints {
|
||||
private final OffsetTagConstraints mTopControlsConstraints;
|
||||
private final OffsetTagConstraints mContentConstraints;
|
||||
private final OffsetTagConstraints mBottomControlsConstraints;
|
||||
private final @Nullable OffsetTagConstraints mTopControlsConstraints;
|
||||
private final @Nullable OffsetTagConstraints mContentConstraints;
|
||||
private final @Nullable OffsetTagConstraints mBottomControlsConstraints;
|
||||
|
||||
public BrowserControlsOffsetTagConstraints(
|
||||
OffsetTagConstraints topControlsConstraints,
|
||||
OffsetTagConstraints contentConstraints,
|
||||
OffsetTagConstraints bottomControlsConstraints) {
|
||||
@Nullable OffsetTagConstraints topControlsConstraints,
|
||||
@Nullable OffsetTagConstraints contentConstraints,
|
||||
@Nullable OffsetTagConstraints bottomControlsConstraints) {
|
||||
mTopControlsConstraints = topControlsConstraints;
|
||||
mContentConstraints = contentConstraints;
|
||||
mBottomControlsConstraints = bottomControlsConstraints;
|
||||
}
|
||||
|
||||
@CalledByNative
|
||||
public OffsetTagConstraints getTopControlsConstraints() {
|
||||
public @Nullable OffsetTagConstraints getTopControlsConstraints() {
|
||||
return mTopControlsConstraints;
|
||||
}
|
||||
|
||||
@CalledByNative
|
||||
public OffsetTagConstraints getContentConstraints() {
|
||||
public @Nullable OffsetTagConstraints getContentConstraints() {
|
||||
return mContentConstraints;
|
||||
}
|
||||
|
||||
@CalledByNative
|
||||
public OffsetTagConstraints getBottomControlsConstraints() {
|
||||
public @Nullable OffsetTagConstraints getBottomControlsConstraints() {
|
||||
return mBottomControlsConstraints;
|
||||
}
|
||||
}
|
||||
|
@ -8,10 +8,12 @@ import com.google.errorprone.annotations.DoNotMock;
|
||||
|
||||
import org.jni_zero.CalledByNative;
|
||||
|
||||
import org.chromium.build.annotations.NullMarked;
|
||||
import org.chromium.cc.input.BrowserControlsOffsetTags;
|
||||
|
||||
/** Java counterpart to the native ui::BrowserControlsOffsetTagDefinitions. */
|
||||
@DoNotMock("This is a simple value object.")
|
||||
@NullMarked
|
||||
public final class BrowserControlsOffsetTagDefinitions {
|
||||
private final BrowserControlsOffsetTags mTags;
|
||||
private final BrowserControlsOffsetTagConstraints mConstraints;
|
||||
|
@ -8,8 +8,11 @@ import com.google.errorprone.annotations.DoNotMock;
|
||||
|
||||
import org.jni_zero.CalledByNative;
|
||||
|
||||
import org.chromium.build.annotations.NullMarked;
|
||||
|
||||
/** Java counterpart to the native viz::OffsetTagConstraints. */
|
||||
@DoNotMock("This is a simple value object.")
|
||||
@NullMarked
|
||||
public final class OffsetTagConstraints {
|
||||
public float mMinX;
|
||||
public float mMinY;
|
||||
|
Reference in New Issue
Block a user