Revert "Adding client side logging for receivers."

This reverts commit 2c34dcd95606389ba8b9f9f88de244d640312db1.

Reason for revert: Not WAI, logging on user-debug builds (not just eng) and not logging across the binder appropriately

Droidfood blocking bug:213406883

Change-Id: Ifff533d280cce22fbf877dd265e4910ab9230943
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index c5ea2bc..756833a 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -1786,7 +1786,6 @@
                     && ((flags & Context.RECEIVER_NOT_EXPORTED) == 0)) {
                 flags = flags | Context.RECEIVER_EXPORTED;
             }
-
             final Intent intent = ActivityManager.getService().registerReceiverWithFeature(
                     mMainThread.getApplicationThread(), mBasePackageName, getAttributionTag(),
                     AppOpsManager.toReceiverId(receiver), rd, filter, broadcastPermission, userId,
@@ -1801,9 +1800,6 @@
             return intent;
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
-        } catch (WtfException e) {
-            Log.wtf(TAG, e.getMessage());
-            return null;
         }
     }
 
diff --git a/core/java/android/app/WtfException.java b/core/java/android/app/WtfException.java
deleted file mode 100644
index ba8dbef..0000000
--- a/core/java/android/app/WtfException.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.app;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * Exception meant to be thrown instead of calling Log.wtf() such that server side code can
- * throw this exception, and it will carry across the binder to do client side logging.
- * {@hide}
- */
-public final class WtfException extends RuntimeException implements Parcelable {
-    public static final @android.annotation.NonNull
-            Creator<WtfException> CREATOR = new Creator<WtfException>() {
-                @Override
-                public WtfException createFromParcel(Parcel source) {
-                    return new WtfException(source.readString8());
-                }
-
-                @Override
-                public WtfException[] newArray(int size) {
-                    return new WtfException[size];
-                }
-            };
-
-    public WtfException(@android.annotation.NonNull String message) {
-        super(message);
-    }
-
-    /** {@hide} */
-    public static Throwable readFromParcel(Parcel in) {
-        final String msg = in.readString8();
-        return new WtfException(msg);
-    }
-
-    /** {@hide} */
-    public static void writeToParcel(Parcel out, Throwable t) {
-        out.writeString8(t.getMessage());
-    }
-
-    @Override
-    public int describeContents() {
-        return 0;
-    }
-
-    @Override
-    public void writeToParcel(@android.annotation.NonNull Parcel dest, int flags) {
-        dest.writeString8(getMessage());
-    }
-}
-
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index d92fda6..02a16fc 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -188,7 +188,6 @@
 import android.app.PropertyInvalidatedCache;
 import android.app.SyncNotedAppOp;
 import android.app.WaitResult;
-import android.app.WtfException;
 import android.app.backup.BackupManager.OperationType;
 import android.app.backup.IBackupManager;
 import android.app.compat.CompatChanges;
@@ -12616,7 +12615,6 @@
         int callingUid;
         int callingPid;
         boolean instantApp;
-        boolean throwWtfException = false;
         synchronized(this) {
             if (caller != null) {
                 callerApp = getRecordForAppLOSP(caller);
@@ -12711,9 +12709,13 @@
                                         + "RECEIVER_NOT_EXPORTED be specified when registering a "
                                         + "receiver");
                     } else {
-                        // will be removed when enforcement is required
+                        Slog.wtf(TAG,
+                                callerPackage + ": Targeting T+ (version "
+                                        + Build.VERSION_CODES.TIRAMISU
+                                        + " and above) requires that one of RECEIVER_EXPORTED or "
+                                        + "RECEIVER_NOT_EXPORTED be specified when registering a "
+                                        + "receiver");
                         // Assume default behavior-- flag check is not enforced
-                        throwWtfException = true;
                         flags |= Context.RECEIVER_EXPORTED;
                     }
                 } else if (!requireExplicitFlagForDynamicReceivers) {
@@ -12844,15 +12846,6 @@
                 }
             }
 
-            if (throwWtfException) {
-                throw new WtfException(
-                        callerPackage + ": Targeting T+ (version "
-                                + Build.VERSION_CODES.TIRAMISU
-                                + " and above) requires that one of RECEIVER_EXPORTED or "
-                                + "RECEIVER_NOT_EXPORTED be specified when registering a "
-                                + "receiver");
-            }
-
             return sticky;
         }
     }