From 232654be2ad1a67fc0a7178d3d6ab114c9f47f44 Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Mon, 8 May 2023 13:59:52 -0700 Subject: [PATCH] Use empty string instead of nullable for leak report email Leak report email was set to be nullable in some modules and not nullable in others. This was causing undeterministic build failures when building SystemUI with gradle. Removing nullable annotation from leak report email dependency and using empty string instead of null. Only setting the email in leak report email intent when the email string is not null or empty. Bug: 281537214 Test: full build: m -j Change-Id: Ic798ae8aba76ba29f9ded8dd8a549fd4c31962a6 --- .../SystemUI/src/com/android/systemui/Dependency.java | 1 - .../android/systemui/dagger/ReferenceSystemUIModule.java | 9 +++------ .../src/com/android/systemui/tv/TvSystemUIModule.java | 9 +++------ .../src/com/android/systemui/util/leak/LeakReporter.java | 9 ++++----- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java index aade71a83c28d..be5bb07089dda 100644 --- a/packages/SystemUI/src/com/android/systemui/Dependency.java +++ b/packages/SystemUI/src/com/android/systemui/Dependency.java @@ -320,7 +320,6 @@ public class Dependency { @Inject @Main Lazy mMainLooper; @Inject @Main Lazy mMainHandler; @Inject @Named(TIME_TICK_HANDLER_NAME) Lazy mTimeTickHandler; - @Nullable @Inject @Named(LEAK_REPORT_EMAIL_NAME) Lazy mLeakReportEmail; @Inject @Main Lazy mMainExecutor; @Inject @Background Lazy mBackgroundExecutor; diff --git a/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java index d5a41460c89ed..f68bd49230d9e 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java @@ -23,8 +23,6 @@ import android.content.Context; import android.hardware.SensorPrivacyManager; import android.os.Handler; -import androidx.annotation.Nullable; - import com.android.internal.logging.UiEventLogger; import com.android.keyguard.KeyguardViewController; import com.android.systemui.battery.BatterySaverModule; @@ -74,12 +72,12 @@ import com.android.systemui.statusbar.policy.SensorPrivacyController; import com.android.systemui.statusbar.policy.SensorPrivacyControllerImpl; import com.android.systemui.volume.dagger.VolumeModule; -import javax.inject.Named; - import dagger.Binds; import dagger.Module; import dagger.Provides; +import javax.inject.Named; + /** * A dagger module for injecting default implementations of components of System UI. * @@ -115,9 +113,8 @@ public abstract class ReferenceSystemUIModule { @SysUISingleton @Provides @Named(LEAK_REPORT_EMAIL_NAME) - @Nullable static String provideLeakReportEmail() { - return null; + return ""; } @Binds diff --git a/packages/SystemUI/src/com/android/systemui/tv/TvSystemUIModule.java b/packages/SystemUI/src/com/android/systemui/tv/TvSystemUIModule.java index 0a78d896e1bd3..d9a8e0cfb53ae 100644 --- a/packages/SystemUI/src/com/android/systemui/tv/TvSystemUIModule.java +++ b/packages/SystemUI/src/com/android/systemui/tv/TvSystemUIModule.java @@ -23,8 +23,6 @@ import android.content.Context; import android.hardware.SensorPrivacyManager; import android.os.Handler; -import androidx.annotation.Nullable; - import com.android.internal.logging.UiEventLogger; import com.android.keyguard.KeyguardViewController; import com.android.systemui.dagger.ReferenceSystemUIModule; @@ -75,13 +73,13 @@ import com.android.systemui.statusbar.policy.SensorPrivacyControllerImpl; import com.android.systemui.statusbar.tv.notifications.TvNotificationHandler; import com.android.systemui.volume.dagger.VolumeModule; -import javax.inject.Named; - import dagger.Binds; import dagger.Module; import dagger.Provides; import dagger.multibindings.IntoSet; +import javax.inject.Named; + /** * A TV specific version of {@link ReferenceSystemUIModule}. * @@ -105,9 +103,8 @@ public abstract class TvSystemUIModule { @SysUISingleton @Provides @Named(LEAK_REPORT_EMAIL_NAME) - @Nullable static String provideLeakReportEmail() { - return null; + return ""; } @Binds diff --git a/packages/SystemUI/src/com/android/systemui/util/leak/LeakReporter.java b/packages/SystemUI/src/com/android/systemui/util/leak/LeakReporter.java index a0d22f388cbc3..c1b7d7a874f3d 100644 --- a/packages/SystemUI/src/com/android/systemui/util/leak/LeakReporter.java +++ b/packages/SystemUI/src/com/android/systemui/util/leak/LeakReporter.java @@ -18,7 +18,6 @@ package com.android.systemui.util.leak; import static com.android.systemui.Dependency.LEAK_REPORT_EMAIL_NAME; -import android.annotation.Nullable; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; @@ -29,6 +28,7 @@ import android.content.Intent; import android.net.Uri; import android.os.Debug; import android.os.SystemProperties; +import android.text.TextUtils; import android.util.Log; import androidx.core.content.FileProvider; @@ -68,7 +68,7 @@ public class LeakReporter { @Inject public LeakReporter(Context context, UserTracker userTracker, LeakDetector leakDetector, - @Nullable @Named(LEAK_REPORT_EMAIL_NAME) String leakReportEmail) { + @Named(LEAK_REPORT_EMAIL_NAME) String leakReportEmail) { mContext = context; mUserTracker = userTracker; mLeakDetector = leakDetector; @@ -150,9 +150,8 @@ public class LeakReporter { intent.setClipData(clipData); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments); - String leakReportEmail = mLeakReportEmail; - if (leakReportEmail != null) { - intent.putExtra(Intent.EXTRA_EMAIL, new String[] { leakReportEmail }); + if (!TextUtils.isEmpty(mLeakReportEmail)) { + intent.putExtra(Intent.EXTRA_EMAIL, new String[] { mLeakReportEmail }); } return intent;