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

Commit 566b03f4 authored by Hall Liu's avatar Hall Liu
Browse files

Move Binder.clearCallingIdentity

Move the clearCallingIdentity call outside the executor

Change-Id: Ic87c2f8e2b1874bd4405b25b1682b5b1a7d900cb
Fixes: 117794412
Test: CTS
parent 0af8c5c7
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -43,19 +43,19 @@ public class InternalDownloadProgressListener extends IDownloadProgressListener.
            return;
        }

        long token = Binder.clearCallingIdentity();
        try {
            mExecutor.execute(new Runnable() {
                @Override
                public void run() {
                long token = Binder.clearCallingIdentity();
                try {
                    mAppListener.onProgressUpdated(request, fileInfo, currentDownloadSize,
                            fullDownloadSize, currentDecodedSize, fullDecodedSize);
                }
            });
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }
        });
    }

    public void stop() {
        mIsStopped = true;
+27 −27
Original line number Diff line number Diff line
@@ -40,18 +40,18 @@ public class InternalDownloadSessionCallback extends IMbmsDownloadSessionCallbac
            return;
        }

        long token = Binder.clearCallingIdentity();
        try {
            mExecutor.execute(new Runnable() {
                @Override
                public void run() {
                long token = Binder.clearCallingIdentity();
                try {
                    mAppCallback.onError(errorCode, message);
                }
            });
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }
        });
    }

    @Override
    public void onFileServicesUpdated(final List<FileServiceInfo> services) {
@@ -59,18 +59,18 @@ public class InternalDownloadSessionCallback extends IMbmsDownloadSessionCallbac
            return;
        }

        long token = Binder.clearCallingIdentity();
        try {
            mExecutor.execute(new Runnable() {
                @Override
                public void run() {
                long token = Binder.clearCallingIdentity();
                try {
                    mAppCallback.onFileServicesUpdated(services);
                }
            });
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }
        });
    }

    @Override
    public void onMiddlewareReady() {
@@ -78,18 +78,18 @@ public class InternalDownloadSessionCallback extends IMbmsDownloadSessionCallbac
            return;
        }

        long token = Binder.clearCallingIdentity();
        try {
            mExecutor.execute(new Runnable() {
                @Override
                public void run() {
                long token = Binder.clearCallingIdentity();
                try {
                    mAppCallback.onMiddlewareReady();
                }
            });
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }
        });
    }

    public void stop() {
        mIsStopped = true;
+9 −9
Original line number Diff line number Diff line
@@ -42,18 +42,18 @@ public class InternalDownloadStatusListener extends IDownloadStatusListener.Stub
            return;
        }

        long token = Binder.clearCallingIdentity();
        try {
            mExecutor.execute(new Runnable() {
                @Override
                public void run() {
                long token = Binder.clearCallingIdentity();
                try {
                    mAppListener.onStatusUpdated(request, fileInfo, status);
                }
            });
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }
        });
    }

    public void stop() {
        mIsStopped = true;
+27 −27
Original line number Diff line number Diff line
@@ -38,18 +38,18 @@ public class InternalGroupCallCallback extends IGroupCallCallback.Stub {
            return;
        }

        long token = Binder.clearCallingIdentity();
        try {
            mExecutor.execute(new Runnable() {
                @Override
                public void run() {
                long token = Binder.clearCallingIdentity();
                try {
                    mAppCallback.onError(errorCode, message);
                }
            });
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }
        });
    }

    @Override
    public void onGroupCallStateChanged(final int state, final int reason) {
@@ -57,18 +57,18 @@ public class InternalGroupCallCallback extends IGroupCallCallback.Stub {
            return;
        }

        long token = Binder.clearCallingIdentity();
        try {
            mExecutor.execute(new Runnable() {
                @Override
                public void run() {
                long token = Binder.clearCallingIdentity();
                try {
                    mAppCallback.onGroupCallStateChanged(state, reason);
                }
            });
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }
        });
    }

    @Override
    public void onBroadcastSignalStrengthUpdated(final int signalStrength) {
@@ -76,18 +76,18 @@ public class InternalGroupCallCallback extends IGroupCallCallback.Stub {
            return;
        }

        long token = Binder.clearCallingIdentity();
        try {
            mExecutor.execute(new Runnable() {
                @Override
                public void run() {
                long token = Binder.clearCallingIdentity();
                try {
                    mAppCallback.onBroadcastSignalStrengthUpdated(signalStrength);
                }
            });
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }
        });
    }

    /** Prevents this callback from calling the app */
    public void stop() {
+36 −36
Original line number Diff line number Diff line
@@ -39,18 +39,18 @@ public class InternalGroupCallSessionCallback extends IMbmsGroupCallSessionCallb
            return;
        }

        long token = Binder.clearCallingIdentity();
        try {
            mExecutor.execute(new Runnable() {
                @Override
                public void run() {
                long token = Binder.clearCallingIdentity();
                try {
                    mAppCallback.onError(errorCode, message);
                }
            });
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }
        });
    }

    @Override
    public void onAvailableSaisUpdated(final List currentSais, final List availableSais) {
@@ -58,18 +58,18 @@ public class InternalGroupCallSessionCallback extends IMbmsGroupCallSessionCallb
            return;
        }

        long token = Binder.clearCallingIdentity();
        try {
            mExecutor.execute(new Runnable() {
                @Override
                public void run() {
                long token = Binder.clearCallingIdentity();
                try {
                    mAppCallback.onAvailableSaisUpdated(currentSais, availableSais);
                }
            });
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }
        });
    }

    @Override
    public void onServiceInterfaceAvailable(final String interfaceName, final int index) {
@@ -77,18 +77,18 @@ public class InternalGroupCallSessionCallback extends IMbmsGroupCallSessionCallb
            return;
        }

        long token = Binder.clearCallingIdentity();
        try {
            mExecutor.execute(new Runnable() {
                @Override
                public void run() {
                long token = Binder.clearCallingIdentity();
                try {
                    mAppCallback.onServiceInterfaceAvailable(interfaceName, index);
                }
            });
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }
        });
    }

    @Override
    public void onMiddlewareReady() {
@@ -96,18 +96,18 @@ public class InternalGroupCallSessionCallback extends IMbmsGroupCallSessionCallb
            return;
        }

        long token = Binder.clearCallingIdentity();
        try {
            mExecutor.execute(new Runnable() {
                @Override
                public void run() {
                long token = Binder.clearCallingIdentity();
                try {
                    mAppCallback.onMiddlewareReady();
                }
            });
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }
        });
    }

    /** Prevents this callback from calling the app */
    public void stop() {
Loading