Fix minimum sdk using @hide API
DocumentsUI is a mainline module being required to have minimum sdk.
To use @hide API and this API may be public, it will give -2 in
presubmit process. Mark the functions have the usage of OverlayManager.
Bug: 249664195
Reference: go/mainline-newapi#strict-updatability-linting
Reference: go/mainline-newapi#suppressing-specific-calls
Test: OUT_SOONG="out/soong/.intermediates" ; \
DOCSUI_PATH="vendor/unbundled_google/packages/DocumentsUIGoogle"; \
PIM="DocumentsUIGoogle/android_common/lint/"; \
m ${OUT_SOONG}/${DOCSUI_PATH}/${PIM}/lint-baseline.xml
Test: presubmit
Change-Id: Icbbde81e841392a5189d77aad62bd4d0f2f4b81f
diff --git a/src/com/android/documentsui/DocumentsApplication.java b/src/com/android/documentsui/DocumentsApplication.java
index c7e21a4..c576851 100644
--- a/src/com/android/documentsui/DocumentsApplication.java
+++ b/src/com/android/documentsui/DocumentsApplication.java
@@ -16,6 +16,7 @@
package com.android.documentsui;
+import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.app.Application;
import android.content.BroadcastReceiver;
@@ -115,6 +116,7 @@
Log.d(TAG, "OverlayManager.setEnabled() result: " + result);
}
+ @SuppressLint("NewApi") // OverlayManager.class is @hide
@Override
public void onCreate() {
super.onCreate();
diff --git a/src/com/android/documentsui/PreBootReceiver.java b/src/com/android/documentsui/PreBootReceiver.java
index f5ad939..2bdbee5 100644
--- a/src/com/android/documentsui/PreBootReceiver.java
+++ b/src/com/android/documentsui/PreBootReceiver.java
@@ -19,6 +19,7 @@
import static com.android.documentsui.base.Shared.LAUNCHER_TARGET_CLASS;
import static com.android.documentsui.base.SharedMinimal.DEBUG;
+import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
@@ -45,6 +46,7 @@
private static final String DOWNLOADS_TARGET_CLASS =
"com.android.documentsui.ViewDownloadsActivity";
+ @SuppressLint("NewApi") // OverlayManager is @hdie
@Override
public void onReceive(Context context, Intent intent) {
final PackageManager pm = context.getPackageManager();