summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralk3pInjection <webmaster@raspii.tech>2023-09-15 08:06:32 +0800
committeralk3pInjection <webmaster@raspii.tech>2023-09-17 12:54:04 +0800
commit0fbeab0484da18a1f8367182a5f84945f8bf656d (patch)
tree8588242d2159d0cb4f473eda7de85656b41859a0
parent3eb76da33cd361f94c30ea3ebc150e8db0f2bb1b (diff)
fwb: Entirely drop qti servicetracker dependency
which appears to be some kind of useless debugging stuff Change-Id: I34f21a85ff4b556912774b053100b80dd1488879
-rw-r--r--services/core/Android.bp2
-rw-r--r--services/core/java/com/android/server/am/ActiveServices.java125
-rw-r--r--services/core/java/com/android/server/wm/ActivityRecord.java101
-rw-r--r--services/core/java/com/android/server/wm/ActivityTaskManagerDebugConfig.java2
-rw-r--r--services/core/java/com/android/server/wm/ActivityTaskSupervisor.java26
5 files changed, 0 insertions, 256 deletions
diff --git a/services/core/Android.bp b/services/core/Android.bp
index 987cb2a755be..34745270650c 100644
--- a/services/core/Android.bp
+++ b/services/core/Android.bp
@@ -177,8 +177,6 @@ java_library_static {
"overlayable_policy_aidl-java",
"SurfaceFlingerProperties",
"com.android.sysprop.watchdog",
- "vendor.qti.hardware.servicetracker-V1.0-java",
- "vendor.qti.hardware.servicetracker-V1.2-java",
],
javac_shard_size: 50,
}
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index ec678ff493af..6e9513e7c3ab 100644
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -195,10 +195,6 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Predicate;
-import vendor.qti.hardware.servicetracker.V1_0.IServicetracker;
-import vendor.qti.hardware.servicetracker.V1_0.ServiceData;
-import vendor.qti.hardware.servicetracker.V1_0.ClientData;
-
public final class ActiveServices {
private static final String TAG = TAG_WITH_CLASS_NAME ? "ActiveServices" : TAG_AM;
private static final String TAG_MU = TAG + POSTFIX_MU;
@@ -341,11 +337,6 @@ public final class ActiveServices {
/** Amount of time to allow a last ANR message to exist before freeing the memory. */
static final int LAST_ANR_LIFETIME_DURATION_MSECS = 2 * 60 * 60 * 1000; // Two hours
- private IServicetracker mServicetracker;
-
- private final boolean isLowRamDevice =
- SystemProperties.getBoolean("ro.config.low_ram", false);
-
String mLastAnrDump;
AppWidgetManagerInternal mAppWidgetManagerInternal;
@@ -616,24 +607,6 @@ public final class ActiveServices {
}
}
- private boolean getServicetrackerInstance() {
- if (mServicetracker == null ) {
- try {
- mServicetracker = IServicetracker.getService(false);
- } catch (java.util.NoSuchElementException e) {
- // Service doesn't exist or cannot be opened logged below
- } catch (RemoteException e) {
- if (DEBUG_SERVICE) Slog.e(TAG, "Failed to get servicetracker interface", e);
- return false;
- }
- if (mServicetracker == null) {
- if (DEBUG_SERVICE) Slog.w(TAG, "servicetracker HIDL not available");
- return false;
- }
- }
- return true;
- }
-
ServiceRecord getServiceByNameLocked(ComponentName name, int callingUser) {
// TODO: Deal with global services
if (DEBUG_MU)
@@ -2996,32 +2969,6 @@ public final class ActiveServices {
}
clist.add(c);
- if (!isLowRamDevice) {
- ServiceData sData = new ServiceData();
- sData.packageName = s.packageName;
- sData.processName = s.shortInstanceName;
- sData.lastActivity = s.lastActivity;
- if (s.app != null) {
- sData.pid = s.app.getPid();
- sData.serviceB = s.app.mState.isServiceB();
- } else {
- sData.pid = -1;
- sData.serviceB = false;
- }
-
- ClientData cData = new ClientData();
- cData.processName = callerApp.processName;
- cData.pid = callerApp.getPid();
- try {
- if (getServicetrackerInstance()) {
- mServicetracker.bindService(sData, cData);
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "Failed to send bind details to servicetracker HAL", e);
- mServicetracker = null;
- }
- }
-
boolean needOomAdj = false;
if ((flags&Context.BIND_AUTO_CREATE) != 0) {
s.lastActivity = SystemClock.uptimeMillis();
@@ -3234,31 +3181,6 @@ public final class ActiveServices {
try {
while (clist.size() > 0) {
ConnectionRecord r = clist.get(0);
- if (!isLowRamDevice) {
- ServiceData sData = new ServiceData();
- sData.packageName = r.binding.service.packageName;
- sData.processName = r.binding.service.shortInstanceName;
- sData.lastActivity = r.binding.service.lastActivity;
- if(r.binding.service.app != null) {
- sData.pid = r.binding.service.app.getPid();
- sData.serviceB = r.binding.service.app.mState.isServiceB();
- } else {
- sData.pid = -1;
- sData.serviceB = false;
- }
-
- ClientData cData = new ClientData();
- cData.processName = r.binding.client.processName;
- cData.pid = r.binding.client.getPid();
- try {
- if (getServicetrackerInstance()) {
- mServicetracker.unbindService(sData, cData);
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "Failed to send unbind details to servicetracker HAL", e);
- mServicetracker = null;
- }
- }
removeConnectionLocked(r, null, null, true);
if (clist.size() > 0 && clist.get(0) == r) {
// In case it didn't get removed above, do it now.
@@ -4546,24 +4468,6 @@ public final class ActiveServices {
app.mState.getReportedProcState());
r.postNotification();
created = true;
-
- if (!isLowRamDevice) {
- ServiceData sData = new ServiceData();
- sData.packageName = r.packageName;
- sData.processName = r.shortInstanceName;
- sData.pid = r.app.getPid();
- sData.lastActivity = r.lastActivity;
- sData.serviceB = r.app.mState.isServiceB();
-
- try {
- if (getServicetrackerInstance()) {
- mServicetracker.startService(sData);
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "Failed to send start details to servicetracker HAL", e);
- mServicetracker = null;
- }
- }
} catch (DeadObjectException e) {
Slog.w(TAG, "Application dead when creating service " + r);
mAm.appDiedLocked(app, "Died when creating service");
@@ -4763,27 +4667,7 @@ public final class ActiveServices {
private void bringDownServiceLocked(ServiceRecord r, boolean enqueueOomAdj) {
//Slog.i(TAG, "Bring down service:");
//r.dump(" ");
- if (!isLowRamDevice) {
- ServiceData sData = new ServiceData();
- sData.packageName = r.packageName;
- sData.processName = r.shortInstanceName;
- sData.lastActivity = r.lastActivity;
- if (r.app != null) {
- sData.pid = r.app.getPid();
- } else {
- sData.pid = -1;
- sData.serviceB = false;
- }
- try {
- if (getServicetrackerInstance()) {
- mServicetracker.destroyService(sData);
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "Failed to send destroy details to servicetracker HAL", e);
- mServicetracker = null;
- }
- }
// Report to all of the connections that the service is no longer
// available.
ArrayMap<IBinder, ArrayList<ConnectionRecord>> connections = r.getConnections();
@@ -5626,15 +5510,6 @@ public final class ActiveServices {
}
}
- try {
- if (!isLowRamDevice && getServicetrackerInstance()) {
- mServicetracker.killProcess(app.getPid());
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "Failed to send kill process details to servicetracker HAL", e);
- mServicetracker = null;
- }
-
// Clean up any connections this application has to other services.
for (int i = psr.numberOfConnections() - 1; i >= 0; i--) {
ConnectionRecord r = psr.getConnectionAt(i);
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index d5b9608dda9a..fd0cd9665ef1 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -193,7 +193,6 @@ import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_SWITCH;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_TRANSITION;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_USER_LEAVING;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_VISIBILITY;
-import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_SERVICETRACKER;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_ADD_REMOVE;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_APP;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_CONFIGURATION;
@@ -303,7 +302,6 @@ import android.os.PersistableBundle;
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.os.SystemProperties;
import android.os.Trace;
import android.os.UserHandle;
import android.service.contentcapture.ActivityEvent;
@@ -384,10 +382,6 @@ import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Predicate;
-import vendor.qti.hardware.servicetracker.V1_2.IServicetracker;
-import vendor.qti.hardware.servicetracker.V1_2.ActivityDetails;
-import vendor.qti.hardware.servicetracker.V1_2.ActivityStats;
-import vendor.qti.hardware.servicetracker.V1_2.ActivityStates;
/**
* An entry in the history task, representing an activity.
*/
@@ -648,9 +642,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
public BoostFramework mPerf = null;
public BoostFramework mPerf_iop = null;
- private final boolean isLowRamDevice =
- SystemProperties.getBoolean("ro.config.low_ram", false);
-
boolean mVoiceInteraction;
private int mPendingRelaunchCount;
@@ -2089,7 +2080,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
resultWho = _resultWho;
requestCode = _reqCode;
setState(INITIALIZING, "ActivityRecord ctor");
- callServiceTrackeronActivityStatechange(INITIALIZING, true);
launchFailed = false;
stopped = false;
delayedResume = false;
@@ -3702,7 +3692,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
// destroyed when the next activity reports idle.
addToStopping(false /* scheduleIdle */, false /* idleDelayed */,
"completeFinishing");
- callServiceTrackeronActivityStatechange(STOPPING, true);
setState(STOPPING, "completeFinishing");
} else if (addToFinishingAndWaitForIdle()) {
// We added this activity to the finishing list and something else is becoming
@@ -3729,7 +3718,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
* destroying it until the next one starts.
*/
boolean destroyIfPossible(String reason) {
- callServiceTrackeronActivityStatechange(FINISHING, true);
setState(FINISHING, "destroyIfPossible");
// Make sure the record is cleaned out of other places.
@@ -3781,7 +3769,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
@VisibleForTesting
boolean addToFinishingAndWaitForIdle() {
ProtoLog.v(WM_DEBUG_STATES, "Enqueueing pending finish: %s", this);
- callServiceTrackeronActivityStatechange(FINISHING, true);
setState(FINISHING, "addToFinishingAndWaitForIdle");
if (!mTaskSupervisor.mFinishingActivities.contains(this)) {
mTaskSupervisor.mFinishingActivities.add(this);
@@ -3852,14 +3839,12 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
// we are not removing it from the list.
if (finishing && !skipDestroy) {
ProtoLog.v(WM_DEBUG_STATES, "Moving to DESTROYING: %s (destroy requested)", this);
- callServiceTrackeronActivityStatechange(DESTROYING, true);
setState(DESTROYING,
"destroyActivityLocked. finishing and not skipping destroy");
mAtmService.mH.postDelayed(mDestroyTimeoutRunnable, DESTROY_TIMEOUT);
} else {
ProtoLog.v(WM_DEBUG_STATES, "Moving to DESTROYED: %s "
+ "(destroy skipped)", this);
- callServiceTrackeronActivityStatechange(DESTROYED, true);
setState(DESTROYED,
"destroyActivityLocked. not finishing or skipping destroy");
if (DEBUG_APP) Slog.v(TAG_APP, "Clearing app during destroy for activity " + this);
@@ -3872,7 +3857,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
removedFromHistory = true;
} else {
ProtoLog.v(WM_DEBUG_STATES, "Moving to DESTROYED: %s (no app)", this);
- callServiceTrackeronActivityStatechange(DESTROYED, true);
setState(DESTROYED, "destroyActivityLocked. not finishing and had no app");
}
}
@@ -3909,7 +3893,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
removeTimeouts();
ProtoLog.v(WM_DEBUG_STATES, "Moving to DESTROYED: %s (removed from history)",
this);
- callServiceTrackeronActivityStatechange(DESTROYED, true);
setState(DESTROYED, "removeFromHistory");
if (DEBUG_APP) Slog.v(TAG_APP, "Clearing app during remove for activity " + this);
detachFromProcess();
@@ -4007,7 +3990,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
frozenBeforeDestroy = false;
if (setState) {
- callServiceTrackeronActivityStatechange(DESTROYED, true);
setState(DESTROYED, "cleanUp");
if (DEBUG_APP) Slog.v(TAG_APP, "Clearing app during cleanUp for activity " + this);
detachFromProcess();
@@ -5676,8 +5658,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
mState = state;
- callServiceTrackeronActivityStatechange(state, false);
-
if (getTaskFragment() != null) {
getTaskFragment().onActivityStateChanged(this, state, reason);
}
@@ -5744,79 +5724,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
}
}
- void callServiceTrackeronActivityStatechange(State state, boolean early_notify) {
- IServicetracker mServicetracker;
- ActivityDetails aDetails = new ActivityDetails();
- ActivityStats aStats = new ActivityStats();
- int aState = ActivityStates.UNKNOWN;
-
- aDetails.launchedFromPid = this.launchedFromPid;
- aDetails.launchedFromUid = this.launchedFromUid;
- aDetails.packageName = this.packageName;
- aDetails.processName = (this.processName!= null)? this.processName:"none";
- aDetails.intent = this.intent.getComponent().toString();
- aDetails.className = this.intent.getComponent().getClassName();
- aDetails.versioncode = this.info.applicationInfo.versionCode;
-
- aStats.createTime = this.createTime;
- aStats.lastVisibleTime = this.lastVisibleTime;
- aStats.launchCount = this.launchCount;
- aStats.lastLaunchTime = this.lastLaunchTime;
-
- switch(state) {
- case INITIALIZING :
- aState = ActivityStates.INITIALIZING;
- break;
- case STARTED :
- aState = ActivityStates.STARTED;
- break;
- case RESUMED :
- aState = ActivityStates.RESUMED;
- break;
- case PAUSING :
- aState = ActivityStates.PAUSING;
- break;
- case PAUSED :
- aState = ActivityStates.PAUSED;
- break;
- case STOPPING :
- aState = ActivityStates.STOPPING;
- break;
- case STOPPED:
- aState = ActivityStates.STOPPED;
- break;
- case FINISHING :
- aState = ActivityStates.FINISHING;
- break;
- case DESTROYING:
- aState = ActivityStates.DESTROYING;
- break;
- case DESTROYED :
- aState = ActivityStates.DESTROYED;
- break;
- case RESTARTING_PROCESS:
- aState = ActivityStates.RESTARTING_PROCESS;
- break;
- }
- if (!isLowRamDevice) {
- if(DEBUG_SERVICETRACKER) {
- Slog.v(TAG, "Calling mServicetracker.OnActivityStateChange with flag "
- + early_notify + " state " + state);
- }
- try {
- mServicetracker = mAtmService.mTaskSupervisor.getServicetrackerInstance();
- if (mServicetracker != null)
- mServicetracker.OnActivityStateChange(aState, aDetails, aStats, early_notify);
- else
- Slog.e(TAG, "Unable to get servicetracker HAL instance");
- } catch (RemoteException e) {
- Slog.e(TAG, "Failed to send activity state change details to servicetracker HAL", e);
- mAtmService.mTaskSupervisor.destroyServicetrackerInstance();
- }
- }
-
- }
-
State getState() {
return mState;
}
@@ -6127,7 +6034,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
}
// An activity must be in the {@link PAUSING} state for the system to validate
// the move to {@link PAUSED}.
- callServiceTrackeronActivityStatechange(PAUSING, true);
setState(PAUSING, "makeActiveIfNeeded");
try {
mAtmService.getLifecycleManager().scheduleTransaction(app.getThread(), token,
@@ -6141,7 +6047,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
if (DEBUG_VISIBILITY) {
Slog.v(TAG_VISIBILITY, "Start visible activity, " + this);
}
- callServiceTrackeronActivityStatechange(STARTED, true);
setState(STARTED, "makeActiveIfNeeded");
try {
@@ -6373,7 +6278,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
shortComponentName, pausingActivity != null
? pausingActivity.shortComponentName : "(none)");
if (isState(PAUSING)) {
- callServiceTrackeronActivityStatechange(PAUSED, true);
setState(PAUSED, "activityPausedLocked");
if (finishing) {
ProtoLog.v(WM_DEBUG_STATES,
@@ -6445,7 +6349,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
try {
stopped = false;
ProtoLog.v(WM_DEBUG_STATES, "Moving to STOPPING: %s (stop requested)", this);
- callServiceTrackeronActivityStatechange(STOPPING, true);
setState(STOPPING, "stopIfPossible");
getRootTask().onARStopTriggered(this);
@@ -6465,7 +6368,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
// Just in case, assume it to be stopped.
stopped = true;
ProtoLog.v(WM_DEBUG_STATES, "Stop failed; moving to STOPPED: %s", this);
- callServiceTrackeronActivityStatechange(STOPPED, true);
setState(STOPPED, "stopIfPossible");
if (deferRelaunchUntilPaused) {
destroyImmediately("stop-except");
@@ -6499,7 +6401,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
removeStopTimeout();
stopped = true;
if (isStopping) {
- callServiceTrackeronActivityStatechange(STOPPED, true);
setState(STOPPED, "activityStoppedLocked");
}
@@ -9796,7 +9697,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
mAtmService.getAppWarningsLocked().onResumeActivity(this);
} else {
removePauseTimeout();
- callServiceTrackeronActivityStatechange(PAUSED, true);
setState(PAUSED, "relaunchActivityLocked");
}
@@ -9826,7 +9726,6 @@ public final class ActivityRecord extends WindowToken implements WindowManagerSe
}
// The restarting state avoids removing this record when process is died.
- callServiceTrackeronActivityStatechange(RESTARTING_PROCESS, true);
setState(RESTARTING_PROCESS, "restartActivityProcess");
if (!mVisibleRequested || mHaveState) {
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerDebugConfig.java b/services/core/java/com/android/server/wm/ActivityTaskManagerDebugConfig.java
index 6671b360ed0b..33d1b44b9743 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerDebugConfig.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerDebugConfig.java
@@ -58,8 +58,6 @@ public class ActivityTaskManagerDebugConfig {
static final boolean DEBUG_ACTIVITY_STARTS = DEBUG_ALL || false;
public static final boolean DEBUG_CLEANUP = DEBUG_ALL || false;
public static final boolean DEBUG_METRICS = DEBUG_ALL || false;
- //Flag to enable Servicetracker logs in AOSP side
- static final boolean DEBUG_SERVICETRACKER = false;
static final String POSTFIX_APP = APPEND_CATEGORY_NAME ? "_App" : "";
static final String POSTFIX_CLEANUP = (APPEND_CATEGORY_NAME) ? "_Cleanup" : "";
diff --git a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java
index b77c8a9c3c66..d249408eabbf 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java
@@ -162,8 +162,6 @@ import java.util.function.Consumer;
import java.util.Arrays;
import android.os.AsyncTask;
-import vendor.qti.hardware.servicetracker.V1_2.IServicetracker;
-
// TODO: This class has become a dumping ground. Let's
// - Move things relating to the hierarchy to RootWindowContainer
// - Move things relating to activity life cycles to maybe a new class called ActivityLifeCycler
@@ -271,8 +269,6 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
private AppOpsManager mAppOpsManager;
- private IServicetracker mServicetracker;
-
/** Common synchronization logic used to save things to disks. */
PersisterQueue mPersisterQueue;
LaunchParamsPersister mLaunchParamsPersister;
@@ -471,28 +467,6 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
mLaunchParamsPersister.onSystemReady();
}
- public IServicetracker getServicetrackerInstance() {
- if (mServicetracker == null) {
- try {
- mServicetracker = IServicetracker.getService(false);
- } catch (java.util.NoSuchElementException e) {
- // Service doesn't exist or cannot be opened logged below
- } catch (RemoteException e) {
- Slog.e(TAG, "Failed to get servicetracker interface", e);
- return null;
- }
- if (mServicetracker == null) {
- Slog.w(TAG, "servicetracker HIDL not available");
- return null;
- }
- }
- return mServicetracker;
- }
-
- public void destroyServicetrackerInstance() {
- mServicetracker = null;
- }
-
void onUserUnlocked(int userId) {
// Only start persisting when the first user is unlocked. The method call is
// idempotent so there is no side effect to call it again when the second user is