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

Commit 899edf6f authored by Sergey Poromov's avatar Sergey Poromov
Browse files

Fix NPE when null BackupObserver is passed into BackupManager#requestBackup()

BackupManagerService has the null check, but it doesn't work
because passed BackupObserver object is wrapped into
this BackupObserverWrapper.
This was found during GTS testing.

Bug: 27334738
Change-Id: I16dc0230824b326d3fae1f8489f58b0c0d4e1c7c
parent cf7518f7
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -468,7 +468,7 @@ public class BackupManager {
     *
     * @param packages List of package names to backup.
     * @param observer The {@link BackupObserver} to receive callbacks during the backup
     * operation.
     * operation. Could be {@code null}.
     * @return {@link BackupManager#SUCCESS} on success; nonzero on error.
     * @exception  IllegalArgumentException on null or empty {@code packages} param.
     *
@@ -479,8 +479,9 @@ public class BackupManager {
        checkServiceBinder();
        if (sService != null) {
            try {
                BackupObserverWrapper observerWrapper =
                    new BackupObserverWrapper(mContext, observer);
                BackupObserverWrapper observerWrapper = observer == null
                        ? null
                        : new BackupObserverWrapper(mContext, observer);
                return sService.requestBackup(packages, observerWrapper);
            } catch (RemoteException e) {
                Log.e(TAG, "requestBackup() couldn't connect");