Loading core/java/Android.bp +10 −9 Original line number Diff line number Diff line Loading @@ -104,14 +104,15 @@ release_package_messagequeue_implementation_srcs { out: ["android/os/MessageQueue.java"], } aidl_library { name: "IDropBoxManagerService_aidl", srcs: [ "com/android/internal/os/IDropBoxManagerService.aidl", ], hdrs: [ "android/os/DropBoxManager.aidl", ], 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 }, }, } filegroup { Loading Loading @@ -348,7 +349,7 @@ filegroup { "com/android/internal/util/XmlSerializerWrapper.java", "com/android/internal/util/XmlPullParserWrapper.java", "com/android/internal/util/XmlUtils.java", ] ], } // keep these files in sync with the apex/jobscheduler/service jarjar-rules.txt for Loading core/java/android/os/DropBoxManager.aidldeleted 100644 → 0 +0 −19 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"; core/java/android/os/DropBoxManager.java +27 −20 Original line number Diff line number Diff line Loading @@ -202,6 +202,16 @@ public class DropBoxManager { mFlags = flags; } private Entry(@NonNull IDropBoxManagerService.Entry internalEntry) { if (internalEntry == null) throw new NullPointerException("internalEntry == null"); mTag = internalEntry.tag; mTimeMillis = internalEntry.timestampMillis; 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) { } Loading Loading @@ -266,15 +276,9 @@ 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) { 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); } IDropBoxManagerService.Entry internalEntry = IDropBoxManagerService.Entry.CREATOR.createFromParcel(in); return internalEntry == null ? null : new Entry(internalEntry); } }; Loading @@ -283,15 +287,17 @@ public class DropBoxManager { } public void writeToParcel(Parcel out, int 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); toInternalEntry().writeToParcel(out, flags); } private IDropBoxManagerService.Entry toInternalEntry() { IDropBoxManagerService.Entry internalEntry = new IDropBoxManagerService.Entry(); internalEntry.tag = mTag; internalEntry.timestampMillis = mTimeMillis; internalEntry.fd = mFileDescriptor; internalEntry.flags = mFlags; internalEntry.data = mData; return internalEntry; } } Loading Loading @@ -393,8 +399,9 @@ public class DropBoxManager { @RequiresPermission(allOf = { READ_DROPBOX_DATA, PACKAGE_USAGE_STATS }) public @Nullable Entry getNextEntry(String tag, long msec) { try { return mService.getNextEntryWithAttribution(tag, msec, mContext.getOpPackageName(), mContext.getAttributionTag()); IDropBoxManagerService.Entry entry = mService.getNextEntryWithAttribution( tag, msec, mContext.getOpPackageName(), mContext.getAttributionTag()); return entry == null ? null : new Entry(entry); } catch (SecurityException e) { if (mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.P) { throw e; Loading core/java/com/android/internal/os/IDropBoxManagerService.aidl +15 −3 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.internal.os; import android.os.DropBoxManager; import android.os.ParcelFileDescriptor; /** Loading @@ -36,8 +35,21 @@ interface IDropBoxManagerService { /** @see DropBoxManager#getNextEntry */ @UnsupportedAppUsage(maxTargetSdk=30, publicAlternatives="Use {@link android.os.DropBoxManager#getNextEntry} instead") DropBoxManager.Entry getNextEntry(String tag, long millis, String packageName); Entry getNextEntry(String tag, long millis, String packageName); DropBoxManager.Entry getNextEntryWithAttribution(String tag, long millis, String packageName, 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 timestampMillis; int flags; ParcelFileDescriptor fd; byte[] data; } } libs/services/Android.bp +15 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ cc_library_shared { "libcutils", "liblog", "libutils", "dropboxmanager_aidl-cpp", ], header_libs: [ "libbase_headers", Loading @@ -42,7 +43,6 @@ cc_library_shared { aidl: { libs: [ "ILogcatManagerService_aidl", "IDropBoxManagerService_aidl", ], }, Loading @@ -56,3 +56,17 @@ cc_library_shared { "-Wunreachable-code", ], } cc_test { name: "DropBoxManagerTestCpp", team: "trendy_team_framework_bpm", srcs: [ "test/DropBoxManagerTest.cpp", ], shared_libs: [ "libbase", "libservices", "libutils", ], require_root: true, } Loading
core/java/Android.bp +10 −9 Original line number Diff line number Diff line Loading @@ -104,14 +104,15 @@ release_package_messagequeue_implementation_srcs { out: ["android/os/MessageQueue.java"], } aidl_library { name: "IDropBoxManagerService_aidl", srcs: [ "com/android/internal/os/IDropBoxManagerService.aidl", ], hdrs: [ "android/os/DropBoxManager.aidl", ], 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 }, }, } filegroup { Loading Loading @@ -348,7 +349,7 @@ filegroup { "com/android/internal/util/XmlSerializerWrapper.java", "com/android/internal/util/XmlPullParserWrapper.java", "com/android/internal/util/XmlUtils.java", ] ], } // keep these files in sync with the apex/jobscheduler/service jarjar-rules.txt for Loading
core/java/android/os/DropBoxManager.aidldeleted 100644 → 0 +0 −19 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";
core/java/android/os/DropBoxManager.java +27 −20 Original line number Diff line number Diff line Loading @@ -202,6 +202,16 @@ public class DropBoxManager { mFlags = flags; } private Entry(@NonNull IDropBoxManagerService.Entry internalEntry) { if (internalEntry == null) throw new NullPointerException("internalEntry == null"); mTag = internalEntry.tag; mTimeMillis = internalEntry.timestampMillis; 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) { } Loading Loading @@ -266,15 +276,9 @@ 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) { 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); } IDropBoxManagerService.Entry internalEntry = IDropBoxManagerService.Entry.CREATOR.createFromParcel(in); return internalEntry == null ? null : new Entry(internalEntry); } }; Loading @@ -283,15 +287,17 @@ public class DropBoxManager { } public void writeToParcel(Parcel out, int 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); toInternalEntry().writeToParcel(out, flags); } private IDropBoxManagerService.Entry toInternalEntry() { IDropBoxManagerService.Entry internalEntry = new IDropBoxManagerService.Entry(); internalEntry.tag = mTag; internalEntry.timestampMillis = mTimeMillis; internalEntry.fd = mFileDescriptor; internalEntry.flags = mFlags; internalEntry.data = mData; return internalEntry; } } Loading Loading @@ -393,8 +399,9 @@ public class DropBoxManager { @RequiresPermission(allOf = { READ_DROPBOX_DATA, PACKAGE_USAGE_STATS }) public @Nullable Entry getNextEntry(String tag, long msec) { try { return mService.getNextEntryWithAttribution(tag, msec, mContext.getOpPackageName(), mContext.getAttributionTag()); IDropBoxManagerService.Entry entry = mService.getNextEntryWithAttribution( tag, msec, mContext.getOpPackageName(), mContext.getAttributionTag()); return entry == null ? null : new Entry(entry); } catch (SecurityException e) { if (mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.P) { throw e; Loading
core/java/com/android/internal/os/IDropBoxManagerService.aidl +15 −3 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.internal.os; import android.os.DropBoxManager; import android.os.ParcelFileDescriptor; /** Loading @@ -36,8 +35,21 @@ interface IDropBoxManagerService { /** @see DropBoxManager#getNextEntry */ @UnsupportedAppUsage(maxTargetSdk=30, publicAlternatives="Use {@link android.os.DropBoxManager#getNextEntry} instead") DropBoxManager.Entry getNextEntry(String tag, long millis, String packageName); Entry getNextEntry(String tag, long millis, String packageName); DropBoxManager.Entry getNextEntryWithAttribution(String tag, long millis, String packageName, 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 timestampMillis; int flags; ParcelFileDescriptor fd; byte[] data; } }
libs/services/Android.bp +15 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ cc_library_shared { "libcutils", "liblog", "libutils", "dropboxmanager_aidl-cpp", ], header_libs: [ "libbase_headers", Loading @@ -42,7 +43,6 @@ cc_library_shared { aidl: { libs: [ "ILogcatManagerService_aidl", "IDropBoxManagerService_aidl", ], }, Loading @@ -56,3 +56,17 @@ cc_library_shared { "-Wunreachable-code", ], } cc_test { name: "DropBoxManagerTestCpp", team: "trendy_team_framework_bpm", srcs: [ "test/DropBoxManagerTest.cpp", ], shared_libs: [ "libbase", "libservices", "libutils", ], require_root: true, }