Loading services/core/java/com/android/server/EventLogTags.logtags +13 −0 Original line number Diff line number Diff line Loading @@ -264,3 +264,16 @@ option java_package com.android.server # GestureLauncherService.java # --------------------------- 40100 camera_gesture_triggered (gesture_on_time|2|3), (sensor1_on_time|2|3), (sensor2_on_time|2|3), (event_extra|1|1) # --------------------------- # timezone/RulesManagerService.java # --------------------------- 51600 timezone_trigger_check (token|3) 51610 timezone_request_install (token|3) 51611 timezone_install_started (token|3) 51612 timezone_install_complete (token|3), (result|1) 51620 timezone_request_uninstall (token|3) 51621 timezone_uninstall_started (token|3) 51622 timezone_uninstall_complete (token|3), (result|1) 51630 timezone_request_nothing (token|3) 51631 timezone_nothing_complete (token|3) services/core/java/com/android/server/timezone/IntentHelperImpl.java +3 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.timezone; import com.android.server.EventLogTags; import android.app.timezone.RulesUpdaterContract; import android.content.BroadcastReceiver; import android.content.Context; Loading @@ -24,8 +26,6 @@ import android.content.IntentFilter; import android.os.PatternMatcher; import android.util.Slog; import java.util.regex.Pattern; /** * The bona fide implementation of {@link IntentHelper}. */ Loading Loading @@ -75,6 +75,7 @@ final class IntentHelperImpl implements IntentHelper { public void sendTriggerUpdateCheck(CheckToken checkToken) { RulesUpdaterContract.sendBroadcast( mContext, mUpdaterAppPackageName, checkToken.toByteArray()); EventLogTags.writeTimezoneTriggerCheck(checkToken.toString()); } @Override Loading services/core/java/com/android/server/timezone/RulesManagerService.java +20 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.timezone; import com.android.internal.annotations.VisibleForTesting; import com.android.server.EventLogTags; import com.android.server.SystemService; import com.android.timezone.distro.DistroException; import com.android.timezone.distro.DistroVersion; Loading Loading @@ -56,8 +57,6 @@ import static android.app.timezone.RulesState.STAGED_OPERATION_NONE; import static android.app.timezone.RulesState.STAGED_OPERATION_UNINSTALL; import static android.app.timezone.RulesState.STAGED_OPERATION_UNKNOWN; // TODO(nfuller) Add EventLog calls where useful in the system server. // TODO(nfuller) Check logging best practices in the system server. // TODO(nfuller) Check error handling best practices in the system server. public final class RulesManagerService extends IRulesManager.Stub { Loading Loading @@ -203,6 +202,7 @@ public final class RulesManagerService extends IRulesManager.Stub { if (checkTokenBytes != null) { checkToken = createCheckTokenOrThrow(checkTokenBytes); } EventLogTags.writeTimezoneRequestInstall(toStringOrNull(checkToken)); synchronized (this) { if (distroParcelFileDescriptor == null) { Loading Loading @@ -254,6 +254,8 @@ public final class RulesManagerService extends IRulesManager.Stub { @Override public void run() { EventLogTags.writeTimezoneInstallStarted(toStringOrNull(mCheckToken)); boolean success = false; // Adopt the ParcelFileDescriptor into this try-with-resources so it is closed // when we are done. Loading @@ -266,6 +268,7 @@ public final class RulesManagerService extends IRulesManager.Stub { TimeZoneDistro distro = new TimeZoneDistro(is); int installerResult = mInstaller.stageInstallWithErrorCode(distro); int resultCode = mapInstallerResultToApiCode(installerResult); EventLogTags.writeTimezoneInstallComplete(toStringOrNull(mCheckToken), resultCode); sendFinishedStatus(mCallback, resultCode); // All the installer failure modes are currently non-recoverable and won't be Loading @@ -273,6 +276,8 @@ public final class RulesManagerService extends IRulesManager.Stub { success = true; } catch (Exception e) { Slog.w(TAG, "Failed to install distro.", e); EventLogTags.writeTimezoneInstallComplete( toStringOrNull(mCheckToken), Callback.ERROR_UNKNOWN_FAILURE); sendFinishedStatus(mCallback, Callback.ERROR_UNKNOWN_FAILURE); } finally { // Notify the package tracker that the operation is now complete. Loading Loading @@ -308,6 +313,7 @@ public final class RulesManagerService extends IRulesManager.Stub { if (checkTokenBytes != null) { checkToken = createCheckTokenOrThrow(checkTokenBytes); } EventLogTags.writeTimezoneRequestUninstall(toStringOrNull(checkToken)); synchronized(this) { if (callback == null) { throw new NullPointerException("callback == null"); Loading Loading @@ -337,6 +343,7 @@ public final class RulesManagerService extends IRulesManager.Stub { @Override public void run() { EventLogTags.writeTimezoneUninstallStarted(toStringOrNull(mCheckToken)); boolean success = false; try { success = mInstaller.stageUninstall(); Loading @@ -344,8 +351,12 @@ public final class RulesManagerService extends IRulesManager.Stub { // against SUCCESS. More granular failures may be added in future. int resultCode = success ? Callback.SUCCESS : Callback.ERROR_UNKNOWN_FAILURE; EventLogTags.writeTimezoneUninstallComplete( toStringOrNull(mCheckToken), resultCode); sendFinishedStatus(mCallback, resultCode); } catch (Exception e) { EventLogTags.writeTimezoneUninstallComplete( toStringOrNull(mCheckToken), Callback.ERROR_UNKNOWN_FAILURE); Slog.w(TAG, "Failed to uninstall distro.", e); sendFinishedStatus(mCallback, Callback.ERROR_UNKNOWN_FAILURE); } finally { Loading @@ -372,7 +383,9 @@ public final class RulesManagerService extends IRulesManager.Stub { if (checkTokenBytes != null) { checkToken = createCheckTokenOrThrow(checkTokenBytes); } EventLogTags.writeTimezoneRequestNothing(toStringOrNull(checkToken)); mPackageTracker.recordCheckResult(checkToken, success); EventLogTags.writeTimezoneNothingComplete(toStringOrNull(checkToken)); } @Override Loading Loading @@ -445,6 +458,7 @@ public final class RulesManagerService extends IRulesManager.Stub { pw.println("RulesManagerService state: " + toString()); pw.println("Active rules version (ICU, libcore): " + ICU.getTZDataVersion() + "," + ZoneInfoDB.getInstance().getVersion()); pw.println("Distro state: " + rulesState.toString()); mPackageTracker.dump(pw); } Loading Loading @@ -491,4 +505,8 @@ public final class RulesManagerService extends IRulesManager.Stub { return "Unknown"; } } private static String toStringOrNull(Object obj) { return obj == null ? null : obj.toString(); } } Loading
services/core/java/com/android/server/EventLogTags.logtags +13 −0 Original line number Diff line number Diff line Loading @@ -264,3 +264,16 @@ option java_package com.android.server # GestureLauncherService.java # --------------------------- 40100 camera_gesture_triggered (gesture_on_time|2|3), (sensor1_on_time|2|3), (sensor2_on_time|2|3), (event_extra|1|1) # --------------------------- # timezone/RulesManagerService.java # --------------------------- 51600 timezone_trigger_check (token|3) 51610 timezone_request_install (token|3) 51611 timezone_install_started (token|3) 51612 timezone_install_complete (token|3), (result|1) 51620 timezone_request_uninstall (token|3) 51621 timezone_uninstall_started (token|3) 51622 timezone_uninstall_complete (token|3), (result|1) 51630 timezone_request_nothing (token|3) 51631 timezone_nothing_complete (token|3)
services/core/java/com/android/server/timezone/IntentHelperImpl.java +3 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.timezone; import com.android.server.EventLogTags; import android.app.timezone.RulesUpdaterContract; import android.content.BroadcastReceiver; import android.content.Context; Loading @@ -24,8 +26,6 @@ import android.content.IntentFilter; import android.os.PatternMatcher; import android.util.Slog; import java.util.regex.Pattern; /** * The bona fide implementation of {@link IntentHelper}. */ Loading Loading @@ -75,6 +75,7 @@ final class IntentHelperImpl implements IntentHelper { public void sendTriggerUpdateCheck(CheckToken checkToken) { RulesUpdaterContract.sendBroadcast( mContext, mUpdaterAppPackageName, checkToken.toByteArray()); EventLogTags.writeTimezoneTriggerCheck(checkToken.toString()); } @Override Loading
services/core/java/com/android/server/timezone/RulesManagerService.java +20 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.timezone; import com.android.internal.annotations.VisibleForTesting; import com.android.server.EventLogTags; import com.android.server.SystemService; import com.android.timezone.distro.DistroException; import com.android.timezone.distro.DistroVersion; Loading Loading @@ -56,8 +57,6 @@ import static android.app.timezone.RulesState.STAGED_OPERATION_NONE; import static android.app.timezone.RulesState.STAGED_OPERATION_UNINSTALL; import static android.app.timezone.RulesState.STAGED_OPERATION_UNKNOWN; // TODO(nfuller) Add EventLog calls where useful in the system server. // TODO(nfuller) Check logging best practices in the system server. // TODO(nfuller) Check error handling best practices in the system server. public final class RulesManagerService extends IRulesManager.Stub { Loading Loading @@ -203,6 +202,7 @@ public final class RulesManagerService extends IRulesManager.Stub { if (checkTokenBytes != null) { checkToken = createCheckTokenOrThrow(checkTokenBytes); } EventLogTags.writeTimezoneRequestInstall(toStringOrNull(checkToken)); synchronized (this) { if (distroParcelFileDescriptor == null) { Loading Loading @@ -254,6 +254,8 @@ public final class RulesManagerService extends IRulesManager.Stub { @Override public void run() { EventLogTags.writeTimezoneInstallStarted(toStringOrNull(mCheckToken)); boolean success = false; // Adopt the ParcelFileDescriptor into this try-with-resources so it is closed // when we are done. Loading @@ -266,6 +268,7 @@ public final class RulesManagerService extends IRulesManager.Stub { TimeZoneDistro distro = new TimeZoneDistro(is); int installerResult = mInstaller.stageInstallWithErrorCode(distro); int resultCode = mapInstallerResultToApiCode(installerResult); EventLogTags.writeTimezoneInstallComplete(toStringOrNull(mCheckToken), resultCode); sendFinishedStatus(mCallback, resultCode); // All the installer failure modes are currently non-recoverable and won't be Loading @@ -273,6 +276,8 @@ public final class RulesManagerService extends IRulesManager.Stub { success = true; } catch (Exception e) { Slog.w(TAG, "Failed to install distro.", e); EventLogTags.writeTimezoneInstallComplete( toStringOrNull(mCheckToken), Callback.ERROR_UNKNOWN_FAILURE); sendFinishedStatus(mCallback, Callback.ERROR_UNKNOWN_FAILURE); } finally { // Notify the package tracker that the operation is now complete. Loading Loading @@ -308,6 +313,7 @@ public final class RulesManagerService extends IRulesManager.Stub { if (checkTokenBytes != null) { checkToken = createCheckTokenOrThrow(checkTokenBytes); } EventLogTags.writeTimezoneRequestUninstall(toStringOrNull(checkToken)); synchronized(this) { if (callback == null) { throw new NullPointerException("callback == null"); Loading Loading @@ -337,6 +343,7 @@ public final class RulesManagerService extends IRulesManager.Stub { @Override public void run() { EventLogTags.writeTimezoneUninstallStarted(toStringOrNull(mCheckToken)); boolean success = false; try { success = mInstaller.stageUninstall(); Loading @@ -344,8 +351,12 @@ public final class RulesManagerService extends IRulesManager.Stub { // against SUCCESS. More granular failures may be added in future. int resultCode = success ? Callback.SUCCESS : Callback.ERROR_UNKNOWN_FAILURE; EventLogTags.writeTimezoneUninstallComplete( toStringOrNull(mCheckToken), resultCode); sendFinishedStatus(mCallback, resultCode); } catch (Exception e) { EventLogTags.writeTimezoneUninstallComplete( toStringOrNull(mCheckToken), Callback.ERROR_UNKNOWN_FAILURE); Slog.w(TAG, "Failed to uninstall distro.", e); sendFinishedStatus(mCallback, Callback.ERROR_UNKNOWN_FAILURE); } finally { Loading @@ -372,7 +383,9 @@ public final class RulesManagerService extends IRulesManager.Stub { if (checkTokenBytes != null) { checkToken = createCheckTokenOrThrow(checkTokenBytes); } EventLogTags.writeTimezoneRequestNothing(toStringOrNull(checkToken)); mPackageTracker.recordCheckResult(checkToken, success); EventLogTags.writeTimezoneNothingComplete(toStringOrNull(checkToken)); } @Override Loading Loading @@ -445,6 +458,7 @@ public final class RulesManagerService extends IRulesManager.Stub { pw.println("RulesManagerService state: " + toString()); pw.println("Active rules version (ICU, libcore): " + ICU.getTZDataVersion() + "," + ZoneInfoDB.getInstance().getVersion()); pw.println("Distro state: " + rulesState.toString()); mPackageTracker.dump(pw); } Loading Loading @@ -491,4 +505,8 @@ public final class RulesManagerService extends IRulesManager.Stub { return "Unknown"; } } private static String toStringOrNull(Object obj) { return obj == null ? null : obj.toString(); } }