From 4d1abf584fe04b3881feb9a336fba23ff6f91aef Mon Sep 17 00:00:00 2001 From: Hai Zhang Date: Sun, 20 Aug 2023 01:38:42 -0700 Subject: [PATCH] [Fix] Fix lint errors. --- .../android/material/shape/MaterialShapeDrawableAccessor.java | 4 ++++ .../zhanghai/android/files/app/BackgroundActivityStarter.kt | 3 +++ .../android/files/util/ForegroundNotificationManager.kt | 3 +++ 3 files changed, 10 insertions(+) diff --git a/app/src/main/java/com/google/android/material/shape/MaterialShapeDrawableAccessor.java b/app/src/main/java/com/google/android/material/shape/MaterialShapeDrawableAccessor.java index 8890aff93..ed44d116f 100644 --- a/app/src/main/java/com/google/android/material/shape/MaterialShapeDrawableAccessor.java +++ b/app/src/main/java/com/google/android/material/shape/MaterialShapeDrawableAccessor.java @@ -5,6 +5,8 @@ package com.google.android.material.shape; +import android.annotation.SuppressLint; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -13,6 +15,7 @@ public class MaterialShapeDrawableAccessor { private MaterialShapeDrawableAccessor() {} + @SuppressLint("RestrictedApi") public static ElevationOverlayProvider getElevationOverlayProvider( @NonNull MaterialShapeDrawable drawable) { MaterialShapeDrawable.MaterialShapeDrawableState drawableState = @@ -20,6 +23,7 @@ public static ElevationOverlayProvider getElevationOverlayProvider( return drawableState.elevationOverlayProvider; } + @SuppressLint("RestrictedApi") public static void setElevationOverlayProvider( @NonNull MaterialShapeDrawable drawable, @Nullable ElevationOverlayProvider elevationOverlayProvider) { diff --git a/app/src/main/java/me/zhanghai/android/files/app/BackgroundActivityStarter.kt b/app/src/main/java/me/zhanghai/android/files/app/BackgroundActivityStarter.kt index 3f3392ca4..1637a4ea0 100644 --- a/app/src/main/java/me/zhanghai/android/files/app/BackgroundActivityStarter.kt +++ b/app/src/main/java/me/zhanghai/android/files/app/BackgroundActivityStarter.kt @@ -5,6 +5,7 @@ package me.zhanghai.android.files.app +import android.annotation.SuppressLint import android.app.PendingIntent import android.content.Context import android.content.Intent @@ -51,6 +52,8 @@ object BackgroundActivityStarter { Lifecycle.State.STARTED ) + // TODO: Add POST_NOTIFICATIONS permission when targeting API 33. + @SuppressLint("MissingPermission") private fun notifyStartActivity( intent: Intent, title: CharSequence, diff --git a/app/src/main/java/me/zhanghai/android/files/util/ForegroundNotificationManager.kt b/app/src/main/java/me/zhanghai/android/files/util/ForegroundNotificationManager.kt index 10af1587e..8fac77581 100644 --- a/app/src/main/java/me/zhanghai/android/files/util/ForegroundNotificationManager.kt +++ b/app/src/main/java/me/zhanghai/android/files/util/ForegroundNotificationManager.kt @@ -5,6 +5,7 @@ package me.zhanghai.android.files.util +import android.annotation.SuppressLint import android.app.Notification import android.app.Service import me.zhanghai.android.files.app.notificationManager @@ -14,6 +15,8 @@ class ForegroundNotificationManager(private val service: Service) { private var foregroundId = 0 + // TODO: Add POST_NOTIFICATIONS permission when targeting API 33. + @SuppressLint("MissingPermission") fun notify(id: Int, notification: Notification) { synchronized(notifications) { if (notifications.isEmpty()) {