am fc29e0b5: Properly destroy TrustAgentWrapper when not bound
* commit 'fc29e0b5829034d9c0a60882d2a21606b2f513b1': Properly destroy TrustAgentWrapper when not bound
This commit is contained in:
@@ -39,9 +39,7 @@ import android.util.Log;
|
|||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
import android.service.trust.ITrustAgentService;
|
import android.service.trust.ITrustAgentService;
|
||||||
import android.service.trust.ITrustAgentServiceCallback;
|
import android.service.trust.ITrustAgentServiceCallback;
|
||||||
import android.service.trust.TrustAgentService;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -160,7 +158,7 @@ public class TrustAgentWrapper {
|
|||||||
mTrustManagerService.updateTrust(mUserId, false);
|
mTrustManagerService.updateTrust(mUserId, false);
|
||||||
break;
|
break;
|
||||||
case MSG_RESTART_TIMEOUT:
|
case MSG_RESTART_TIMEOUT:
|
||||||
unbind();
|
destroy();
|
||||||
mTrustManagerService.resetAgent(mName, mUserId);
|
mTrustManagerService.resetAgent(mName, mUserId);
|
||||||
break;
|
break;
|
||||||
case MSG_SET_TRUST_AGENT_FEATURES_COMPLETED:
|
case MSG_SET_TRUST_AGENT_FEATURES_COMPLETED:
|
||||||
@@ -367,7 +365,9 @@ public class TrustAgentWrapper {
|
|||||||
return mMessage;
|
return mMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unbind() {
|
public void destroy() {
|
||||||
|
mHandler.removeMessages(MSG_RESTART_TIMEOUT);
|
||||||
|
|
||||||
if (!mBound) {
|
if (!mBound) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -378,7 +378,6 @@ public class TrustAgentWrapper {
|
|||||||
mTrustAgentService = null;
|
mTrustAgentService = null;
|
||||||
mSetTrustAgentFeaturesToken = null;
|
mSetTrustAgentFeaturesToken = null;
|
||||||
mHandler.sendEmptyMessage(MSG_REVOKE_TRUST);
|
mHandler.sendEmptyMessage(MSG_REVOKE_TRUST);
|
||||||
mHandler.removeMessages(MSG_RESTART_TIMEOUT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConnected() {
|
public boolean isConnected() {
|
||||||
|
|||||||
@@ -208,7 +208,8 @@ public class TrustManagerService extends SystemService {
|
|||||||
obsoleteAgents.addAll(mActiveAgents);
|
obsoleteAgents.addAll(mActiveAgents);
|
||||||
|
|
||||||
for (UserInfo userInfo : userInfos) {
|
for (UserInfo userInfo : userInfos) {
|
||||||
if (userInfo.partial || !userInfo.isEnabled() || userInfo.guestToRemove) continue;
|
if (userInfo == null || userInfo.partial || !userInfo.isEnabled()
|
||||||
|
|| userInfo.guestToRemove) continue;
|
||||||
if (!userInfo.supportsSwitchTo()) continue;
|
if (!userInfo.supportsSwitchTo()) continue;
|
||||||
if (!mActivityManager.isUserRunning(userInfo.id)) continue;
|
if (!mActivityManager.isUserRunning(userInfo.id)) continue;
|
||||||
if (lockPatternUtils.getKeyguardStoredPasswordQuality(userInfo.id)
|
if (lockPatternUtils.getKeyguardStoredPasswordQuality(userInfo.id)
|
||||||
@@ -258,7 +259,7 @@ public class TrustManagerService extends SystemService {
|
|||||||
if (info.agent.isManagingTrust()) {
|
if (info.agent.isManagingTrust()) {
|
||||||
trustMayHaveChanged = true;
|
trustMayHaveChanged = true;
|
||||||
}
|
}
|
||||||
info.agent.unbind();
|
info.agent.destroy();
|
||||||
mActiveAgents.remove(info);
|
mActiveAgents.remove(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -290,7 +291,7 @@ public class TrustManagerService extends SystemService {
|
|||||||
if (info.agent.isManagingTrust()) {
|
if (info.agent.isManagingTrust()) {
|
||||||
trustMayHaveChanged = true;
|
trustMayHaveChanged = true;
|
||||||
}
|
}
|
||||||
info.agent.unbind();
|
info.agent.destroy();
|
||||||
mActiveAgents.removeAt(i);
|
mActiveAgents.removeAt(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -308,7 +309,7 @@ public class TrustManagerService extends SystemService {
|
|||||||
if (info.agent.isManagingTrust()) {
|
if (info.agent.isManagingTrust()) {
|
||||||
trustMayHaveChanged = true;
|
trustMayHaveChanged = true;
|
||||||
}
|
}
|
||||||
info.agent.unbind();
|
info.agent.destroy();
|
||||||
mActiveAgents.removeAt(i);
|
mActiveAgents.removeAt(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user