From 9663fd09e9dc14a17d3828665ab11a256c4a5c96 Mon Sep 17 00:00:00 2001 From: Svetoslav Date: Thu, 31 Oct 2013 16:28:20 -0700 Subject: Uninitialized UiAutomationConnection incorrectly enforces caller id. When a client of a UiAutomationConnection is set it remembers its UID and allows subsequent operations only from this UID. The connection If the connection was not used, i.e. its client is not set, and an attempt to destroy it is made the connection enforces the caller UID to be that of the owner but it does not have an owner yet. Now if the destroy method is called on a connection that is never used (has no client) we do not enforce caller UID. bug:11465888 Change-Id: I739dfc45e772ea970b6ab384e4420184724333a3 --- core/java/android/app/UiAutomationConnection.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/java/android/app/UiAutomationConnection.java b/core/java/android/app/UiAutomationConnection.java index 607930c..91b0d7c 100644 --- a/core/java/android/app/UiAutomationConnection.java +++ b/core/java/android/app/UiAutomationConnection.java @@ -146,7 +146,9 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub { @Override public void shutdown() { synchronized (mLock) { - throwIfCalledByNotTrustedUidLocked(); + if (isConnectedLocked()) { + throwIfCalledByNotTrustedUidLocked(); + } throwIfShutdownLocked(); mIsShutdown = true; if (isConnectedLocked()) { -- cgit v1.1