Merge "Logging improvements for time zone updates" am: 2cae07284d am: 42199bf5a0
am: 80aaf8fa37
Change-Id: I0a9687a2aca7f3d189c8536a915bdf4882526af1
This commit is contained in:
@@ -268,3 +268,16 @@ option java_package com.android.server
|
|||||||
# GestureLauncherService.java
|
# 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)
|
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)
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.android.server.timezone;
|
package com.android.server.timezone;
|
||||||
|
|
||||||
|
import com.android.server.EventLogTags;
|
||||||
|
|
||||||
import android.app.timezone.RulesUpdaterContract;
|
import android.app.timezone.RulesUpdaterContract;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -24,8 +26,6 @@ import android.content.IntentFilter;
|
|||||||
import android.os.PatternMatcher;
|
import android.os.PatternMatcher;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The bona fide implementation of {@link IntentHelper}.
|
* The bona fide implementation of {@link IntentHelper}.
|
||||||
*/
|
*/
|
||||||
@@ -75,6 +75,7 @@ final class IntentHelperImpl implements IntentHelper {
|
|||||||
public void sendTriggerUpdateCheck(CheckToken checkToken) {
|
public void sendTriggerUpdateCheck(CheckToken checkToken) {
|
||||||
RulesUpdaterContract.sendBroadcast(
|
RulesUpdaterContract.sendBroadcast(
|
||||||
mContext, mUpdaterAppPackageName, checkToken.toByteArray());
|
mContext, mUpdaterAppPackageName, checkToken.toByteArray());
|
||||||
|
EventLogTags.writeTimezoneTriggerCheck(checkToken.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package com.android.server.timezone;
|
package com.android.server.timezone;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
|
import com.android.server.EventLogTags;
|
||||||
import com.android.server.SystemService;
|
import com.android.server.SystemService;
|
||||||
import com.android.timezone.distro.DistroException;
|
import com.android.timezone.distro.DistroException;
|
||||||
import com.android.timezone.distro.DistroVersion;
|
import com.android.timezone.distro.DistroVersion;
|
||||||
@@ -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_UNINSTALL;
|
||||||
import static android.app.timezone.RulesState.STAGED_OPERATION_UNKNOWN;
|
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.
|
// TODO(nfuller) Check error handling best practices in the system server.
|
||||||
public final class RulesManagerService extends IRulesManager.Stub {
|
public final class RulesManagerService extends IRulesManager.Stub {
|
||||||
|
|
||||||
@@ -203,6 +202,7 @@ public final class RulesManagerService extends IRulesManager.Stub {
|
|||||||
if (checkTokenBytes != null) {
|
if (checkTokenBytes != null) {
|
||||||
checkToken = createCheckTokenOrThrow(checkTokenBytes);
|
checkToken = createCheckTokenOrThrow(checkTokenBytes);
|
||||||
}
|
}
|
||||||
|
EventLogTags.writeTimezoneRequestInstall(toStringOrNull(checkToken));
|
||||||
|
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (distroParcelFileDescriptor == null) {
|
if (distroParcelFileDescriptor == null) {
|
||||||
@@ -254,6 +254,8 @@ public final class RulesManagerService extends IRulesManager.Stub {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
EventLogTags.writeTimezoneInstallStarted(toStringOrNull(mCheckToken));
|
||||||
|
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
// Adopt the ParcelFileDescriptor into this try-with-resources so it is closed
|
// Adopt the ParcelFileDescriptor into this try-with-resources so it is closed
|
||||||
// when we are done.
|
// when we are done.
|
||||||
@@ -266,6 +268,7 @@ public final class RulesManagerService extends IRulesManager.Stub {
|
|||||||
TimeZoneDistro distro = new TimeZoneDistro(is);
|
TimeZoneDistro distro = new TimeZoneDistro(is);
|
||||||
int installerResult = mInstaller.stageInstallWithErrorCode(distro);
|
int installerResult = mInstaller.stageInstallWithErrorCode(distro);
|
||||||
int resultCode = mapInstallerResultToApiCode(installerResult);
|
int resultCode = mapInstallerResultToApiCode(installerResult);
|
||||||
|
EventLogTags.writeTimezoneInstallComplete(toStringOrNull(mCheckToken), resultCode);
|
||||||
sendFinishedStatus(mCallback, resultCode);
|
sendFinishedStatus(mCallback, resultCode);
|
||||||
|
|
||||||
// All the installer failure modes are currently non-recoverable and won't be
|
// All the installer failure modes are currently non-recoverable and won't be
|
||||||
@@ -273,6 +276,8 @@ public final class RulesManagerService extends IRulesManager.Stub {
|
|||||||
success = true;
|
success = true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Slog.w(TAG, "Failed to install distro.", e);
|
Slog.w(TAG, "Failed to install distro.", e);
|
||||||
|
EventLogTags.writeTimezoneInstallComplete(
|
||||||
|
toStringOrNull(mCheckToken), Callback.ERROR_UNKNOWN_FAILURE);
|
||||||
sendFinishedStatus(mCallback, Callback.ERROR_UNKNOWN_FAILURE);
|
sendFinishedStatus(mCallback, Callback.ERROR_UNKNOWN_FAILURE);
|
||||||
} finally {
|
} finally {
|
||||||
// Notify the package tracker that the operation is now complete.
|
// Notify the package tracker that the operation is now complete.
|
||||||
@@ -308,6 +313,7 @@ public final class RulesManagerService extends IRulesManager.Stub {
|
|||||||
if (checkTokenBytes != null) {
|
if (checkTokenBytes != null) {
|
||||||
checkToken = createCheckTokenOrThrow(checkTokenBytes);
|
checkToken = createCheckTokenOrThrow(checkTokenBytes);
|
||||||
}
|
}
|
||||||
|
EventLogTags.writeTimezoneRequestUninstall(toStringOrNull(checkToken));
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
if (callback == null) {
|
if (callback == null) {
|
||||||
throw new NullPointerException("callback == null");
|
throw new NullPointerException("callback == null");
|
||||||
@@ -337,6 +343,7 @@ public final class RulesManagerService extends IRulesManager.Stub {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
EventLogTags.writeTimezoneUninstallStarted(toStringOrNull(mCheckToken));
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
success = mInstaller.stageUninstall();
|
success = mInstaller.stageUninstall();
|
||||||
@@ -344,8 +351,12 @@ public final class RulesManagerService extends IRulesManager.Stub {
|
|||||||
// against SUCCESS. More granular failures may be added in future.
|
// against SUCCESS. More granular failures may be added in future.
|
||||||
int resultCode = success ? Callback.SUCCESS
|
int resultCode = success ? Callback.SUCCESS
|
||||||
: Callback.ERROR_UNKNOWN_FAILURE;
|
: Callback.ERROR_UNKNOWN_FAILURE;
|
||||||
|
EventLogTags.writeTimezoneUninstallComplete(
|
||||||
|
toStringOrNull(mCheckToken), resultCode);
|
||||||
sendFinishedStatus(mCallback, resultCode);
|
sendFinishedStatus(mCallback, resultCode);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
EventLogTags.writeTimezoneUninstallComplete(
|
||||||
|
toStringOrNull(mCheckToken), Callback.ERROR_UNKNOWN_FAILURE);
|
||||||
Slog.w(TAG, "Failed to uninstall distro.", e);
|
Slog.w(TAG, "Failed to uninstall distro.", e);
|
||||||
sendFinishedStatus(mCallback, Callback.ERROR_UNKNOWN_FAILURE);
|
sendFinishedStatus(mCallback, Callback.ERROR_UNKNOWN_FAILURE);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -372,7 +383,9 @@ public final class RulesManagerService extends IRulesManager.Stub {
|
|||||||
if (checkTokenBytes != null) {
|
if (checkTokenBytes != null) {
|
||||||
checkToken = createCheckTokenOrThrow(checkTokenBytes);
|
checkToken = createCheckTokenOrThrow(checkTokenBytes);
|
||||||
}
|
}
|
||||||
|
EventLogTags.writeTimezoneRequestNothing(toStringOrNull(checkToken));
|
||||||
mPackageTracker.recordCheckResult(checkToken, success);
|
mPackageTracker.recordCheckResult(checkToken, success);
|
||||||
|
EventLogTags.writeTimezoneNothingComplete(toStringOrNull(checkToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -445,6 +458,7 @@ public final class RulesManagerService extends IRulesManager.Stub {
|
|||||||
pw.println("RulesManagerService state: " + toString());
|
pw.println("RulesManagerService state: " + toString());
|
||||||
pw.println("Active rules version (ICU, libcore): " + ICU.getTZDataVersion() + ","
|
pw.println("Active rules version (ICU, libcore): " + ICU.getTZDataVersion() + ","
|
||||||
+ ZoneInfoDB.getInstance().getVersion());
|
+ ZoneInfoDB.getInstance().getVersion());
|
||||||
|
pw.println("Distro state: " + rulesState.toString());
|
||||||
mPackageTracker.dump(pw);
|
mPackageTracker.dump(pw);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,4 +505,8 @@ public final class RulesManagerService extends IRulesManager.Stub {
|
|||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String toStringOrNull(Object obj) {
|
||||||
|
return obj == null ? null : obj.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user