Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6efcad3 authored by Steven Moreland's avatar Steven Moreland
Browse files

Revert "Make IDropBoxManagerService compatible with aidl_interface"

This reverts commit 1c6ac92e.

Reason for revert: b/424744354 - GMS crashes.
Bug: 420949170
Bug: 368152571

Change-Id: I6c03e8cd0a68949e92fd6f9ad4624bb203cf301e
parent 2c9667e1
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -104,15 +104,14 @@ release_package_messagequeue_implementation_srcs {
    out: ["android/os/MessageQueue.java"],
}

aidl_interface {
    name: "dropboxmanager_aidl",
    srcs: ["com/android/internal/os/IDropBoxManagerService.aidl"],
    unstable: true,
    backend: {
        java: {
            enabled: false, // TODO(b/424186512) switch frameworks/base to using this as well, it uses core build **/*.aidl glob now
        },
    },
aidl_library {
    name: "IDropBoxManagerService_aidl",
    srcs: [
        "com/android/internal/os/IDropBoxManagerService.aidl",
    ],
    hdrs: [
        "android/os/DropBoxManager.aidl",
    ],
}

filegroup {
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009 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.os;

parcelable DropBoxManager.Entry cpp_header "android/os/DropBoxManager.h";
+20 −27
Original line number Diff line number Diff line
@@ -202,16 +202,6 @@ public class DropBoxManager {
            mFlags = flags;
        }

        private Entry(@NonNull IDropBoxManagerService.Entry internalEntry) {
            if (internalEntry == null) throw new NullPointerException("internalEntry == null");

            mTag = internalEntry.tag;
            mTimeMillis = internalEntry.timestamp;
            mData = internalEntry.data;
            mFileDescriptor = internalEntry.fd;
            mFlags = internalEntry.flags;
        }

        /** Close the input stream associated with this entry. */
        public void close() {
            try { if (mFileDescriptor != null) mFileDescriptor.close(); } catch (IOException e) { }
@@ -276,9 +266,15 @@ public class DropBoxManager {
        public static final @android.annotation.NonNull Parcelable.Creator<Entry> CREATOR = new Parcelable.Creator() {
            public Entry[] newArray(int size) { return new Entry[size]; }
            public Entry createFromParcel(Parcel in) {
                IDropBoxManagerService.Entry internalEntry =
                        IDropBoxManagerService.Entry.CREATOR.createFromParcel(in);
                return internalEntry == null ? null : new Entry(internalEntry);
                String tag = in.readString();
                long millis = in.readLong();
                int flags = in.readInt();
                if ((flags & HAS_BYTE_ARRAY) != 0) {
                    return new Entry(tag, millis, in.createByteArray(), flags & ~HAS_BYTE_ARRAY);
                } else {
                    ParcelFileDescriptor pfd = ParcelFileDescriptor.CREATOR.createFromParcel(in);
                    return new Entry(tag, millis, pfd, flags);
                }
            }
        };

@@ -287,17 +283,15 @@ public class DropBoxManager {
        }

        public void writeToParcel(Parcel out, int flags) {
            toInternalEntry().writeToParcel(out, flags);
            out.writeString(mTag);
            out.writeLong(mTimeMillis);
            if (mFileDescriptor != null) {
                out.writeInt(mFlags & ~HAS_BYTE_ARRAY);  // Clear bit just to be safe
                mFileDescriptor.writeToParcel(out, flags);
            } else {
                out.writeInt(mFlags | HAS_BYTE_ARRAY);
                out.writeByteArray(mData);
            }

        private IDropBoxManagerService.Entry toInternalEntry() {
            IDropBoxManagerService.Entry internalEntry = new IDropBoxManagerService.Entry();
            internalEntry.tag = mTag;
            internalEntry.timestamp = mTimeMillis;
            internalEntry.fd = mFileDescriptor;
            internalEntry.flags = mFlags;
            internalEntry.data = mData;
            return internalEntry;
        }
    }

@@ -399,9 +393,8 @@ public class DropBoxManager {
    @RequiresPermission(allOf = { READ_DROPBOX_DATA, PACKAGE_USAGE_STATS })
    public @Nullable Entry getNextEntry(String tag, long msec) {
        try {
            IDropBoxManagerService.Entry entry = mService.getNextEntryWithAttribution(
                    tag, msec, mContext.getOpPackageName(), mContext.getAttributionTag());
            return entry == null ? null : new Entry(entry);
            return mService.getNextEntryWithAttribution(tag, msec, mContext.getOpPackageName(),
                    mContext.getAttributionTag());
        } catch (SecurityException e) {
            if (mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.P) {
                throw e;
+3 −15
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.internal.os;

import android.os.DropBoxManager;
import android.os.ParcelFileDescriptor;

/**
@@ -35,21 +36,8 @@ interface IDropBoxManagerService {
    /** @see DropBoxManager#getNextEntry */
    @UnsupportedAppUsage(maxTargetSdk=30,
            publicAlternatives="Use {@link android.os.DropBoxManager#getNextEntry} instead")
    Entry getNextEntry(String tag, long millis, String packageName);
    DropBoxManager.Entry getNextEntry(String tag, long millis, String packageName);

    Entry getNextEntryWithAttribution(String tag, long millis, String packageName,
    DropBoxManager.Entry getNextEntryWithAttribution(String tag, long millis, String packageName,
            String attributionTag);

    /**
     * An entry maintained by drop box, including contents and metadata.
     * @hide
     */
    parcelable Entry {
        String tag;
        long timestamp;
        ParcelFileDescriptor fd;
        int flags;
        byte[] data;
    }

}
+1 −15
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ cc_library_shared {
        "libcutils",
        "liblog",
        "libutils",
        "dropboxmanager_aidl-cpp",
    ],
    header_libs: [
        "libbase_headers",
@@ -43,6 +42,7 @@ cc_library_shared {
    aidl: {
        libs: [
            "ILogcatManagerService_aidl",
            "IDropBoxManagerService_aidl",
        ],
    },

@@ -56,17 +56,3 @@ cc_library_shared {
        "-Wunreachable-code",
    ],
}

cc_test {
    name: "DropBoxManagerTestCpp",
    team: "trendy_team_foundations",
    srcs: [
        "test/DropBoxManagerTest.cpp",
    ],
    shared_libs: [
        "libbase",
        "libservices",
        "libutils",
    ],
    require_root: true,
}
Loading