diff options
| author | 2019-11-04 17:40:26 -0800 | |
|---|---|---|
| committer | 2019-11-05 09:03:04 -0800 | |
| commit | a22423972392682bd38009ade798336c28e10dc8 (patch) | |
| tree | 4278e3178c2c2397bdbff1bf745651c90174d3dc | |
| parent | 998a7f9a166e1ab7ba14ba31f0b6bb7888f9c2e7 (diff) | |
Make StatusBar optional in GlobalScreenshot.
Bug: 143911461
Test: Builds on targets that don't provide StatusBar, e.g. ARC++.
Change-Id: I9b2e80e6bf83c1cd0ac8ccfadd8b3c847664a66f
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index 6d7acd9727cd..251ba9e68cc9 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -93,6 +93,7 @@ import java.io.OutputStream; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.Optional; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -100,6 +101,7 @@ import java.util.concurrent.TimeoutException; import javax.inject.Inject; import javax.inject.Singleton; +import dagger.Lazy; /** * POD used in the AsyncTask which saves an image in the background. @@ -921,8 +923,9 @@ public class GlobalScreenshot { private final StatusBar mStatusBar; @Inject - public ActionProxyReceiver(StatusBar statusBar) { - mStatusBar = statusBar; + public ActionProxyReceiver(Optional<Lazy<StatusBar>> statusBarLazy) { + Lazy<StatusBar> statusBar = statusBarLazy.orElse(null); + mStatusBar = statusBar != null ? statusBar.get() : null; } @Override @@ -947,8 +950,13 @@ public class GlobalScreenshot { context.startActivityAsUser(actionIntent, opts.toBundle(), UserHandle.CURRENT); }; - mStatusBar.executeRunnableDismissingKeyguard(startActivityRunnable, null, - true /* dismissShade */, true /* afterKeyguardGone */, true /* deferred */); + if (mStatusBar != null) { + mStatusBar.executeRunnableDismissingKeyguard(startActivityRunnable, null, + true /* dismissShade */, true /* afterKeyguardGone */, + true /* deferred */); + } else { + startActivityRunnable.run(); + } } } |