Home | History | Annotate | Download | only in server

Lines Matching refs:service

55      * Starts a service by class name.
57 * @return The service instance.
66 throw new RuntimeException("Failed to create service " + className
67 + ": service class not found, usually indicates that the caller should "
76 * Creates and starts a system service. The class must be a subclass of
80 * @return The service instance, never null.
81 * @throws RuntimeException if the service fails to start.
90 // Create the service.
93 + ": service must extend " + SystemService.class.getName());
95 final T service;
98 service = constructor.newInstance(mContext);
100 throw new RuntimeException("Failed to create service " + name
101 + ": service could not be instantiated", ex);
103 throw new RuntimeException("Failed to create service " + name
104 + ": service must have a public constructor with a Context argument", ex);
106 throw new RuntimeException("Failed to create service " + name
107 + ": service must have a public constructor with a Context argument", ex);
109 throw new RuntimeException("Failed to create service " + name
110 + ": service constructor threw an exception", ex);
113 startService(service);
114 return service;
120 public void startService(@NonNull final SystemService service) {
122 mServices.add(service);
126 service.onStart();
128 throw new RuntimeException("Failed to start service " + service.getClass().getName()
131 warnIfTooLong(SystemClock.elapsedRealtime() - time, service, "onStart");
151 final SystemService service = mServices.get(i);
153 Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, service.getClass().getName());
155 service.onBootPhase(mCurrentPhase);
157 throw new RuntimeException("Failed to boot service "
158 + service.getClass().getName()
162 warnIfTooLong(SystemClock.elapsedRealtime() - time, service, "onBootPhase");
181 final SystemService service = mServices.get(i);
183 + service.getClass().getName());
186 service.onStartUser(userHandle);
189 + " to service " + service.getClass().getName(), ex);
191 warnIfTooLong(SystemClock.elapsedRealtime() - time, service, "onStartUser ");
200 final SystemService service = mServices.get(i);
202 + service.getClass().getName());
205 service.onUnlockUser(userHandle);
208 + " to service " + service.getClass().getName(), ex);
210 warnIfTooLong(SystemClock.elapsedRealtime() - time, service, "onUnlockUser ");
219 final SystemService service = mServices.get(i);
221 + service.getClass().getName());
224 service.onSwitchUser(userHandle);
227 + " to service " + service.getClass().getName(), ex);
229 warnIfTooLong(SystemClock.elapsedRealtime() - time, service, "onSwitchUser");
238 final SystemService service = mServices.get(i);
240 + service.getClass().getName());
243 service.onStopUser(userHandle);
246 + " to service " + service.getClass().getName(), ex);
248 warnIfTooLong(SystemClock.elapsedRealtime() - time, service, "onStopUser");
257 final SystemService service = mServices.get(i);
259 + service.getClass().getName());
262 service.onCleanupUser(userHandle);
265 + " to service " + service.getClass().getName(), ex);
267 warnIfTooLong(SystemClock.elapsedRealtime() - time, service, "onCleanupUser");
313 private void warnIfTooLong(long duration, SystemService service, String operation) {
315 Slog.w(TAG, "Service " + service.getClass().getName() + " took " + duration + " ms in "
329 final SystemService service = mServices.get(i);
331 .append(service.getClass().getSimpleName())