Unregister receiver when destroying TrustAgentWrapper.

Make sure to unregister the receiver when TrustAgentWrapper gets
detroyed. This will prevent over registering for the receiver and a
potential crash if too many recievers are created. The unregistering and
registering of this receiver now take place in the same location as the
other receiver in the class.

Fixes: 221506550
Test: Trivial
Change-Id: Icfd12949d9edb2fa6fbb052db35c16f950328c9a
This commit is contained in:
Your Name
2022-02-28 01:08:12 +00:00
parent d0cb324a9c
commit 00b540e144

View File

@@ -671,6 +671,7 @@ public class TrustAgentWrapper {
mContext.unbindService(mConnection);
mBound = false;
mContext.unregisterReceiver(mBroadcastReceiver);
mContext.unregisterReceiver(mTrustableDowngradeReceiver);
mTrustAgentService = null;
mSetTrustAgentFeaturesToken = null;
mHandler.sendEmptyMessage(MSG_REVOKE_TRUST);