Loading core/java/android/os/BugreportManager.java +7 −7 Original line number Original line Diff line number Diff line Loading @@ -157,20 +157,20 @@ public final class BugreportManager { Preconditions.checkNotNull(executor); Preconditions.checkNotNull(executor); Preconditions.checkNotNull(callback); Preconditions.checkNotNull(callback); boolean validScreenshotFd = screenshotFd != null; boolean isScreenshotRequested = screenshotFd != null; if (screenshotFd == null) { if (screenshotFd == null) { // Binder needs a valid File Descriptor to be passed // Binder needs a valid File Descriptor to be passed screenshotFd = ParcelFileDescriptor.open(new File("/dev/null"), screenshotFd = ParcelFileDescriptor.open(new File("/dev/null"), ParcelFileDescriptor.MODE_READ_ONLY); ParcelFileDescriptor.MODE_READ_ONLY); } } DumpstateListener dsListener = new DumpstateListener(executor, callback, DumpstateListener dsListener = new DumpstateListener(executor, callback, validScreenshotFd); isScreenshotRequested); // Note: mBinder can get callingUid from the binder transaction. // Note: mBinder can get callingUid from the binder transaction. mBinder.startBugreport(-1 /* callingUid */, mBinder.startBugreport(-1 /* callingUid */, mContext.getOpPackageName(), mContext.getOpPackageName(), bugreportFd.getFileDescriptor(), bugreportFd.getFileDescriptor(), screenshotFd.getFileDescriptor(), screenshotFd.getFileDescriptor(), params.getMode(), dsListener); params.getMode(), dsListener, isScreenshotRequested); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } catch (FileNotFoundException e) { } catch (FileNotFoundException e) { Loading Loading @@ -225,13 +225,13 @@ public final class BugreportManager { private final class DumpstateListener extends IDumpstateListener.Stub { private final class DumpstateListener extends IDumpstateListener.Stub { private final Executor mExecutor; private final Executor mExecutor; private final BugreportCallback mCallback; private final BugreportCallback mCallback; private final boolean mValidScreenshotFd; private final boolean mIsScreenshotRequested; DumpstateListener(Executor executor, BugreportCallback callback, DumpstateListener(Executor executor, BugreportCallback callback, boolean validScreenshotFd) { boolean isScreenshotRequested) { mExecutor = executor; mExecutor = executor; mCallback = callback; mCallback = callback; mValidScreenshotFd = validScreenshotFd; mIsScreenshotRequested = isScreenshotRequested; } } @Override @Override Loading Loading @@ -272,7 +272,7 @@ public final class BugreportManager { @Override @Override public void onScreenshotTaken(boolean success) throws RemoteException { public void onScreenshotTaken(boolean success) throws RemoteException { if (!mValidScreenshotFd) { if (!mIsScreenshotRequested) { return; return; } } Loading services/core/java/com/android/server/os/BugreportManagerServiceImpl.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -66,7 +66,7 @@ class BugreportManagerServiceImpl extends IDumpstate.Stub { @RequiresPermission(android.Manifest.permission.DUMP) @RequiresPermission(android.Manifest.permission.DUMP) public void startBugreport(int callingUidUnused, String callingPackage, public void startBugreport(int callingUidUnused, String callingPackage, FileDescriptor bugreportFd, FileDescriptor screenshotFd, FileDescriptor bugreportFd, FileDescriptor screenshotFd, int bugreportMode, IDumpstateListener listener) { int bugreportMode, IDumpstateListener listener, boolean isScreenshotRequested) { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, "startBugreport"); mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, "startBugreport"); Objects.requireNonNull(callingPackage); Objects.requireNonNull(callingPackage); Objects.requireNonNull(bugreportFd); Objects.requireNonNull(bugreportFd); Loading @@ -88,7 +88,7 @@ class BugreportManagerServiceImpl extends IDumpstate.Stub { } } synchronized (mLock) { synchronized (mLock) { startBugreportLocked(callingUid, callingPackage, bugreportFd, screenshotFd, startBugreportLocked(callingUid, callingPackage, bugreportFd, screenshotFd, bugreportMode, listener); bugreportMode, listener, isScreenshotRequested); } } } } Loading Loading @@ -145,7 +145,7 @@ class BugreportManagerServiceImpl extends IDumpstate.Stub { @GuardedBy("mLock") @GuardedBy("mLock") private void startBugreportLocked(int callingUid, String callingPackage, private void startBugreportLocked(int callingUid, String callingPackage, FileDescriptor bugreportFd, FileDescriptor screenshotFd, FileDescriptor bugreportFd, FileDescriptor screenshotFd, int bugreportMode, IDumpstateListener listener) { int bugreportMode, IDumpstateListener listener, boolean isScreenshotRequested) { if (isDumpstateBinderServiceRunningLocked()) { if (isDumpstateBinderServiceRunningLocked()) { Slog.w(TAG, "'dumpstate' is already running. Cannot start a new bugreport" Slog.w(TAG, "'dumpstate' is already running. Cannot start a new bugreport" + " while another one is currently in progress."); + " while another one is currently in progress."); Loading @@ -165,7 +165,7 @@ class BugreportManagerServiceImpl extends IDumpstate.Stub { IDumpstateListener myListener = new DumpstateListener(listener, ds); IDumpstateListener myListener = new DumpstateListener(listener, ds); try { try { ds.startBugreport(callingUid, callingPackage, ds.startBugreport(callingUid, callingPackage, bugreportFd, screenshotFd, bugreportMode, myListener); bugreportFd, screenshotFd, bugreportMode, myListener, isScreenshotRequested); } catch (RemoteException e) { } catch (RemoteException e) { // bugreportd service is already started now. We need to kill it to manage the // bugreportd service is already started now. We need to kill it to manage the // lifecycle correctly. If we don't subsequent callers will get // lifecycle correctly. If we don't subsequent callers will get Loading Loading
core/java/android/os/BugreportManager.java +7 −7 Original line number Original line Diff line number Diff line Loading @@ -157,20 +157,20 @@ public final class BugreportManager { Preconditions.checkNotNull(executor); Preconditions.checkNotNull(executor); Preconditions.checkNotNull(callback); Preconditions.checkNotNull(callback); boolean validScreenshotFd = screenshotFd != null; boolean isScreenshotRequested = screenshotFd != null; if (screenshotFd == null) { if (screenshotFd == null) { // Binder needs a valid File Descriptor to be passed // Binder needs a valid File Descriptor to be passed screenshotFd = ParcelFileDescriptor.open(new File("/dev/null"), screenshotFd = ParcelFileDescriptor.open(new File("/dev/null"), ParcelFileDescriptor.MODE_READ_ONLY); ParcelFileDescriptor.MODE_READ_ONLY); } } DumpstateListener dsListener = new DumpstateListener(executor, callback, DumpstateListener dsListener = new DumpstateListener(executor, callback, validScreenshotFd); isScreenshotRequested); // Note: mBinder can get callingUid from the binder transaction. // Note: mBinder can get callingUid from the binder transaction. mBinder.startBugreport(-1 /* callingUid */, mBinder.startBugreport(-1 /* callingUid */, mContext.getOpPackageName(), mContext.getOpPackageName(), bugreportFd.getFileDescriptor(), bugreportFd.getFileDescriptor(), screenshotFd.getFileDescriptor(), screenshotFd.getFileDescriptor(), params.getMode(), dsListener); params.getMode(), dsListener, isScreenshotRequested); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } catch (FileNotFoundException e) { } catch (FileNotFoundException e) { Loading Loading @@ -225,13 +225,13 @@ public final class BugreportManager { private final class DumpstateListener extends IDumpstateListener.Stub { private final class DumpstateListener extends IDumpstateListener.Stub { private final Executor mExecutor; private final Executor mExecutor; private final BugreportCallback mCallback; private final BugreportCallback mCallback; private final boolean mValidScreenshotFd; private final boolean mIsScreenshotRequested; DumpstateListener(Executor executor, BugreportCallback callback, DumpstateListener(Executor executor, BugreportCallback callback, boolean validScreenshotFd) { boolean isScreenshotRequested) { mExecutor = executor; mExecutor = executor; mCallback = callback; mCallback = callback; mValidScreenshotFd = validScreenshotFd; mIsScreenshotRequested = isScreenshotRequested; } } @Override @Override Loading Loading @@ -272,7 +272,7 @@ public final class BugreportManager { @Override @Override public void onScreenshotTaken(boolean success) throws RemoteException { public void onScreenshotTaken(boolean success) throws RemoteException { if (!mValidScreenshotFd) { if (!mIsScreenshotRequested) { return; return; } } Loading
services/core/java/com/android/server/os/BugreportManagerServiceImpl.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -66,7 +66,7 @@ class BugreportManagerServiceImpl extends IDumpstate.Stub { @RequiresPermission(android.Manifest.permission.DUMP) @RequiresPermission(android.Manifest.permission.DUMP) public void startBugreport(int callingUidUnused, String callingPackage, public void startBugreport(int callingUidUnused, String callingPackage, FileDescriptor bugreportFd, FileDescriptor screenshotFd, FileDescriptor bugreportFd, FileDescriptor screenshotFd, int bugreportMode, IDumpstateListener listener) { int bugreportMode, IDumpstateListener listener, boolean isScreenshotRequested) { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, "startBugreport"); mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, "startBugreport"); Objects.requireNonNull(callingPackage); Objects.requireNonNull(callingPackage); Objects.requireNonNull(bugreportFd); Objects.requireNonNull(bugreportFd); Loading @@ -88,7 +88,7 @@ class BugreportManagerServiceImpl extends IDumpstate.Stub { } } synchronized (mLock) { synchronized (mLock) { startBugreportLocked(callingUid, callingPackage, bugreportFd, screenshotFd, startBugreportLocked(callingUid, callingPackage, bugreportFd, screenshotFd, bugreportMode, listener); bugreportMode, listener, isScreenshotRequested); } } } } Loading Loading @@ -145,7 +145,7 @@ class BugreportManagerServiceImpl extends IDumpstate.Stub { @GuardedBy("mLock") @GuardedBy("mLock") private void startBugreportLocked(int callingUid, String callingPackage, private void startBugreportLocked(int callingUid, String callingPackage, FileDescriptor bugreportFd, FileDescriptor screenshotFd, FileDescriptor bugreportFd, FileDescriptor screenshotFd, int bugreportMode, IDumpstateListener listener) { int bugreportMode, IDumpstateListener listener, boolean isScreenshotRequested) { if (isDumpstateBinderServiceRunningLocked()) { if (isDumpstateBinderServiceRunningLocked()) { Slog.w(TAG, "'dumpstate' is already running. Cannot start a new bugreport" Slog.w(TAG, "'dumpstate' is already running. Cannot start a new bugreport" + " while another one is currently in progress."); + " while another one is currently in progress."); Loading @@ -165,7 +165,7 @@ class BugreportManagerServiceImpl extends IDumpstate.Stub { IDumpstateListener myListener = new DumpstateListener(listener, ds); IDumpstateListener myListener = new DumpstateListener(listener, ds); try { try { ds.startBugreport(callingUid, callingPackage, ds.startBugreport(callingUid, callingPackage, bugreportFd, screenshotFd, bugreportMode, myListener); bugreportFd, screenshotFd, bugreportMode, myListener, isScreenshotRequested); } catch (RemoteException e) { } catch (RemoteException e) { // bugreportd service is already started now. We need to kill it to manage the // bugreportd service is already started now. We need to kill it to manage the // lifecycle correctly. If we don't subsequent callers will get // lifecycle correctly. If we don't subsequent callers will get Loading