From 0ee2b879b6b7d59eebea7610f06406331f992c56 Mon Sep 17 00:00:00 2001 From: Charles Munger Date: Fri, 15 Nov 2019 11:14:10 -0800 Subject: [PATCH] Deprecate Looper.prepareMainLooper Applications don't need to call this method. Bug: 144042891 Test: No behavior changes Change-Id: I0aab8619cd9afc6b672ae163fba9d17c797c9f26 --- api/current.txt | 2 +- core/java/android/os/Looper.java | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/api/current.txt b/api/current.txt index 1a87b2257d279..681a7551d704a 100644 --- a/api/current.txt +++ b/api/current.txt @@ -34671,7 +34671,7 @@ package android.os { method @Nullable public static android.os.Looper myLooper(); method @NonNull public static android.os.MessageQueue myQueue(); method public static void prepare(); - method public static void prepareMainLooper(); + method @Deprecated public static void prepareMainLooper(); method public void quit(); method public void quitSafely(); method public void setMessageLogging(@Nullable android.util.Printer); diff --git a/core/java/android/os/Looper.java b/core/java/android/os/Looper.java index 3222fc43b2136..d468972df4134 100644 --- a/core/java/android/os/Looper.java +++ b/core/java/android/os/Looper.java @@ -112,10 +112,12 @@ public final class Looper { /** * Initialize the current thread as a looper, marking it as an - * application's main looper. The main looper for your application - * is created by the Android environment, so you should never need - * to call this function yourself. See also: {@link #prepare()} + * application's main looper. See also: {@link #prepare()} + * + * @deprecated The main looper for your application is created by the Android environment, + * so you should never need to call this function yourself. */ + @Deprecated public static void prepareMainLooper() { prepare(false); synchronized (Looper.class) {