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

Commit 86d88c9d authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "aegis-dropbox-revert" into main

* changes:
  Revert "Make IDropBoxManagerService compatible with aidl_interface"
  Revert "Add Rust interface for DropBoxManager"
parents d7c19610 a6efcad3
Loading
Loading
Loading
Loading
+9 −17
Original line number Original line Diff line number Diff line
@@ -104,22 +104,14 @@ release_package_messagequeue_implementation_srcs {
    out: ["android/os/MessageQueue.java"],
    out: ["android/os/MessageQueue.java"],
}
}


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


filegroup {
filegroup {
@@ -303,8 +295,8 @@ java_library {
    name: "modules-utils-locallog",
    name: "modules-utils-locallog",
    srcs: ["android/util/LocalLog.java"],
    srcs: ["android/util/LocalLog.java"],
    libs: [
    libs: [
        "ravenwood-annotations-lib",
        "unsupportedappusage",
        "unsupportedappusage",
        "ravenwood-annotations-lib",
    ],
    ],
    sdk_version: "module_current",
    sdk_version: "module_current",
    min_sdk_version: "30",
    min_sdk_version: "30",
+19 −0
Original line number Original line 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 Original line Diff line number Diff line
@@ -202,16 +202,6 @@ public class DropBoxManager {
            mFlags = flags;
            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. */
        /** Close the input stream associated with this entry. */
        public void close() {
        public void close() {
            try { if (mFileDescriptor != null) mFileDescriptor.close(); } catch (IOException e) { }
            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 static final @android.annotation.NonNull Parcelable.Creator<Entry> CREATOR = new Parcelable.Creator() {
            public Entry[] newArray(int size) { return new Entry[size]; }
            public Entry[] newArray(int size) { return new Entry[size]; }
            public Entry createFromParcel(Parcel in) {
            public Entry createFromParcel(Parcel in) {
                IDropBoxManagerService.Entry internalEntry =
                String tag = in.readString();
                        IDropBoxManagerService.Entry.CREATOR.createFromParcel(in);
                long millis = in.readLong();
                return internalEntry == null ? null : new Entry(internalEntry);
                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) {
        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 })
    @RequiresPermission(allOf = { READ_DROPBOX_DATA, PACKAGE_USAGE_STATS })
    public @Nullable Entry getNextEntry(String tag, long msec) {
    public @Nullable Entry getNextEntry(String tag, long msec) {
        try {
        try {
            IDropBoxManagerService.Entry entry = mService.getNextEntryWithAttribution(
            return mService.getNextEntryWithAttribution(tag, msec, mContext.getOpPackageName(),
                    tag, msec, mContext.getOpPackageName(), mContext.getAttributionTag());
                    mContext.getAttributionTag());
            return entry == null ? null : new Entry(entry);
        } catch (SecurityException e) {
        } catch (SecurityException e) {
            if (mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.P) {
            if (mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.P) {
                throw e;
                throw e;
+3 −15
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package com.android.internal.os;
package com.android.internal.os;


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


/**
/**
@@ -35,21 +36,8 @@ interface IDropBoxManagerService {
    /** @see DropBoxManager#getNextEntry */
    /** @see DropBoxManager#getNextEntry */
    @UnsupportedAppUsage(maxTargetSdk=30,
    @UnsupportedAppUsage(maxTargetSdk=30,
            publicAlternatives="Use {@link android.os.DropBoxManager#getNextEntry} instead")
            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);
            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 −48
Original line number Original line Diff line number Diff line
@@ -35,7 +35,6 @@ cc_library_shared {
        "libcutils",
        "libcutils",
        "liblog",
        "liblog",
        "libutils",
        "libutils",
        "dropboxmanager_aidl-cpp",
    ],
    ],
    header_libs: [
    header_libs: [
        "libbase_headers",
        "libbase_headers",
@@ -43,6 +42,7 @@ cc_library_shared {
    aidl: {
    aidl: {
        libs: [
        libs: [
            "ILogcatManagerService_aidl",
            "ILogcatManagerService_aidl",
            "IDropBoxManagerService_aidl",
        ],
        ],
    },
    },


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

rust_defaults {
    name: "libdropbox_rs_defaults",
    srcs: ["src/dropboxmanager.rs"],
    prefer_rlib: true,
    rustlibs: [
        "libanyhow",
        "libbinder_rs",
        "liblog_rust",
        "liblogger",
        "librustutils",
        "dropboxmanager_aidl-rust",
    ],
}

rust_library {
    name: "libdropbox_rs",
    crate_name: "dropbox_rs",
    defaults: ["libdropbox_rs_defaults"],
    visibility: [
        "//packages/modules/Virtualization:__subpackages__",
    ],
    apex_available: [
        "com.android.virt",
    ],
}

rust_test {
    name: "DropBoxManagerTestRust",
    team: "trendy_team_framework_bpm",
    defaults: ["libdropbox_rs_defaults"],
    require_root: true,
}

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