Log to Slog - part I
Bug: 150470825
Test: Build okay
Change-Id: I3069e71e4d966bc37f985a5191d6e867e544a51a
diff --git a/service/src/com/android/car/admin/CarDevicePolicyService.java b/service/src/com/android/car/admin/CarDevicePolicyService.java
index bbfb733..e7b4143 100644
--- a/service/src/com/android/car/admin/CarDevicePolicyService.java
+++ b/service/src/com/android/car/admin/CarDevicePolicyService.java
@@ -28,7 +28,7 @@
import android.content.pm.UserInfo;
import android.os.UserManager;
import android.sysprop.CarProperties;
-import android.util.Log;
+import android.util.Slog;
import com.android.car.CarServiceBase;
import com.android.car.internal.common.UserHelperLite;
@@ -67,12 +67,12 @@
@Override
public void init() {
- if (DEBUG) Log.d(TAG, "init()");
+ if (DEBUG) Slog.d(TAG, "init()");
}
@Override
public void release() {
- if (DEBUG) Log.d(TAG, "release()");
+ if (DEBUG) Slog.d(TAG, "release()");
}
@Override
@@ -96,7 +96,7 @@
break;
default:
if (DEBUG) {
- Log.d(TAG, "createUser(): invalid userType (" + userType + ") / flags ("
+ Slog.d(TAG, "createUser(): invalid userType (" + userType + ") / flags ("
+ userInfoFlags + ") combination");
}
return new UserCreationResult(UserCreationResult.STATUS_INVALID_REQUEST);
@@ -105,8 +105,8 @@
AndroidFuture<UserCreationResult> receiver = new AndroidFuture<>();
if (DEBUG) {
- Log.d(TAG, "calling createUser(" + UserHelperLite.safeName(name) + "," + userType + ", "
- + userInfoFlags + ", " + HAL_TIMEOUT_MS + ")");
+ Slog.d(TAG, "calling createUser(" + UserHelperLite.safeName(name) + "," + userType
+ + ", " + userInfoFlags + ", " + HAL_TIMEOUT_MS + ")");
}
mCarUserService.createUser(name, userType, userInfoFlags, HAL_TIMEOUT_MS, receiver);
@@ -117,8 +117,8 @@
if (e instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
- Log.w(TAG, "Timeout waiting " + mFutureTimeoutMs + "ms for UserCreationResult's future",
- e);
+ Slog.w(TAG, "Timeout waiting " + mFutureTimeoutMs
+ + "ms for UserCreationResult's future", e);
return new UserCreationResult(UserCreationResult.STATUS_HAL_INTERNAL_FAILURE);
}
}
diff --git a/service/src/com/android/car/am/ContinuousBlankActivity.java b/service/src/com/android/car/am/ContinuousBlankActivity.java
index 10ee382..388404b 100644
--- a/service/src/com/android/car/am/ContinuousBlankActivity.java
+++ b/service/src/com/android/car/am/ContinuousBlankActivity.java
@@ -18,7 +18,7 @@
import android.app.Activity;
import android.os.Bundle;
-import android.util.Log;
+import android.util.Slog;
import com.android.car.R;
@@ -36,6 +36,6 @@
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_continuous_blank);
- Log.i(TAG, "ContinuousBlankActivity created:");
+ Slog.i(TAG, "ContinuousBlankActivity created:");
}
}
diff --git a/service/src/com/android/car/am/FixedActivityService.java b/service/src/com/android/car/am/FixedActivityService.java
index 7e0726f..de2f774 100644
--- a/service/src/com/android/car/am/FixedActivityService.java
+++ b/service/src/com/android/car/am/FixedActivityService.java
@@ -52,6 +52,7 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;
+import android.util.Slog;
import android.util.SparseArray;
import android.view.Display;
@@ -139,7 +140,7 @@
private final UserLifecycleListener mUserLifecycleListener = event -> {
if (Log.isLoggable(TAG_AM, Log.DEBUG)) {
- Log.d(TAG_AM, "onEvent(" + event + ")");
+ Slog.d(TAG_AM, "onEvent(" + event + ")");
}
if (CarUserManager.USER_LIFECYCLE_EVENT_TYPE_SWITCHING == event.getEventType()) {
synchronized (FixedActivityService.this.mLock) {
@@ -158,12 +159,12 @@
|| Intent.ACTION_PACKAGE_REMOVED.equals(action)) {
Uri packageData = intent.getData();
if (packageData == null) {
- Log.w(TAG_AM, "null packageData");
+ Slog.w(TAG_AM, "null packageData");
return;
}
String packageName = packageData.getSchemeSpecificPart();
if (packageName == null) {
- Log.w(TAG_AM, "null packageName");
+ Slog.w(TAG_AM, "null packageName");
return;
}
int uid = intent.getIntExtra(Intent.EXTRA_UID, INVALID_UID);
@@ -176,7 +177,7 @@
// displays. Package name is ignored as one package can affect
// others.
if (info.userId == userId) {
- Log.i(TAG_AM, "Package changed:" + packageName
+ Slog.i(TAG_AM, "Package changed:" + packageName
+ ",user:" + userId + ",action:" + action);
info.resetCrashCounterLocked();
tryLaunch = true;
@@ -226,14 +227,14 @@
@VisibleForTesting
void handleTaskFocusChanged(int taskId, boolean focused) {
- if (DBG) Log.d(TAG_AM, "handleTaskFocusChanged taskId=" + taskId + ", focused=" + focused);
+ if (DBG) Slog.d(TAG_AM, "handleTaskFocusChanged taskId=" + taskId + ", focused=" + focused);
if (!focused) {
return; // We don't care the focus losing events.
}
synchronized (mLock) {
for (int i = mRunningActivities.size() - 1; i >= 0; i--) {
RunningActivityInfo info = mRunningActivities.valueAt(i);
- if (DBG) Log.d(TAG_AM, "Checking " + info);
+ if (DBG) Slog.d(TAG_AM, "Checking " + info);
if (info.taskId == taskId) {
moveFocusBackToDefaultDisplay(taskId);
return;
@@ -249,12 +250,12 @@
RootTaskInfo topStack = tasks.get(0);
int topTaskIdInDefaultDisplay = topStack.childTaskIds[topStack.childTaskIds.length - 1];
if (DBG) {
- Log.d(TAG_AM, "FixedActivity #" + taskId + " got the focus, return back to #"
+ Slog.d(TAG_AM, "FixedActivity #" + taskId + " got the focus, return back to #"
+ topTaskIdInDefaultDisplay);
}
mAtm.setFocusedTask(topTaskIdInDefaultDisplay);
} catch (RemoteException e) {
- Log.e(TAG_AM, "remote exception from ATM", e);
+ Slog.e(TAG_AM, "remote exception from ATM", e);
}
}
@@ -394,13 +395,13 @@
mAm.registerTaskStackListener(mTaskStackListener);
mAm.registerProcessObserver(mProcessObserver);
} catch (RemoteException e) {
- Log.e(TAG_AM, "remote exception from AM", e);
+ Slog.e(TAG_AM, "remote exception from AM", e);
}
try {
carPowerManager.setListener(mCarPowerStateListener);
} catch (Exception e) {
// should not happen
- Log.e(TAG_AM, "Got exception from CarPowerManager", e);
+ Slog.e(TAG_AM, "Got exception from CarPowerManager", e);
}
}
@@ -424,7 +425,7 @@
mAm.unregisterTaskStackListener(mTaskStackListener);
mAm.unregisterProcessObserver(mProcessObserver);
} catch (RemoteException e) {
- Log.e(TAG_AM, "remote exception from AM", e);
+ Slog.e(TAG_AM, "remote exception from AM", e);
}
mContext.unregisterReceiver(mBroadcastReceiver);
}
@@ -434,7 +435,7 @@
try {
return mAm.getAllRootTaskInfos();
} catch (RemoteException e) {
- Log.e(TAG_AM, "remote exception from AM", e);
+ Slog.e(TAG_AM, "remote exception from AM", e);
}
return null;
}
@@ -449,7 +450,7 @@
private boolean launchIfNecessary(int displayId) {
List<RootTaskInfo> infos = getRootTaskInfos();
if (infos == null) {
- Log.e(TAG_AM, "cannot get RootTaskInfo from AM");
+ Slog.e(TAG_AM, "cannot get RootTaskInfo from AM");
return false;
}
long now = SystemClock.elapsedRealtime();
@@ -457,7 +458,7 @@
if (mRunningActivities.size() == 0) {
// it must have been stopped.
if (DBG) {
- Log.i(TAG_AM, "empty activity list", new RuntimeException());
+ Slog.i(TAG_AM, "empty activity list", new RuntimeException());
}
return false;
}
@@ -469,17 +470,17 @@
}
final int displayIdForActivity = mRunningActivities.keyAt(i);
if (activityInfo.taskId != INVALID_TASK_ID) {
- Log.i(TAG_AM, "Finishing fixed activity on user switching:"
+ Slog.i(TAG_AM, "Finishing fixed activity on user switching:"
+ activityInfo);
try {
mAm.removeTask(activityInfo.taskId);
} catch (RemoteException e) {
- Log.e(TAG_AM, "remote exception from AM", e);
+ Slog.e(TAG_AM, "remote exception from AM", e);
}
CarServiceUtils.runOnMain(() -> {
Display display = mDm.getDisplay(displayIdForActivity);
if (display == null) {
- Log.e(TAG_AM, "Display not available, cannot launnch window:"
+ Slog.e(TAG_AM, "Display not available, cannot launnch window:"
+ displayIdForActivity);
return;
}
@@ -489,7 +490,7 @@
synchronized (mLock) {
RunningActivityInfo info = mRunningActivities.get(displayIdForActivity);
if (info != null && info.userId == ActivityManager.getCurrentUser()) {
- Log.i(TAG_AM, "Do not show Presentation, new req already made");
+ Slog.i(TAG_AM, "Do not show Presentation, new req already made");
return;
}
mBlockingPresentations.append(displayIdForActivity, p);
@@ -525,7 +526,7 @@
}
activityInfo.previousTaskId =
taskInfo.childTaskIds[taskInfo.childTaskIds.length - 1];
- Log.i(TAG_AM, "Unmatched top activity will be removed:"
+ Slog.i(TAG_AM, "Unmatched top activity will be removed:"
+ taskInfo.topActivity + " top task id:" + activityInfo.previousTaskId
+ " user:" + topUserId + " display:" + taskInfo.displayId);
activityInfo.inBackground = false;
@@ -563,13 +564,13 @@
// re-tried too many times, give up for now.
if (!activityInfo.failureLogged) {
activityInfo.failureLogged = true;
- Log.w(TAG_AM, "Too many relaunch failure of fixed activity:"
+ Slog.w(TAG_AM, "Too many relaunch failure of fixed activity:"
+ activityInfo);
}
continue;
}
- Log.i(TAG_AM, "Launching Activity for fixed mode. Intent:" + activityInfo.intent
+ Slog.i(TAG_AM, "Launching Activity for fixed mode. Intent:" + activityInfo.intent
+ ",userId:" + UserHandle.of(activityInfo.userId) + ",displayId:"
+ mRunningActivities.keyAt(i));
// Increase retry count if task is not in background. In case like other app is
@@ -587,7 +588,7 @@
activityInfo.isVisible = true;
activityInfo.lastLaunchTimeMs = SystemClock.elapsedRealtime();
} catch (Exception e) { // Catch all for any app related issues.
- Log.w(TAG_AM, "Cannot start activity:" + activityInfo.intent, e);
+ Slog.w(TAG_AM, "Cannot start activity:" + activityInfo.intent, e);
}
}
RunningActivityInfo activityInfo = mRunningActivities.get(displayId);
@@ -604,7 +605,7 @@
private void logComponentNotFound(ComponentName component, @UserIdInt int userId,
Exception e) {
- Log.e(TAG_AM, "Specified Component not found:" + component
+ Slog.e(TAG_AM, "Specified Component not found:" + component
+ " for userid:" + userId, e);
}
@@ -654,7 +655,7 @@
private boolean isDisplayAllowedForFixedMode(int displayId) {
if (displayId == Display.DEFAULT_DISPLAY || displayId == Display.INVALID_DISPLAY) {
- Log.w(TAG_AM, "Target display cannot be used for fixed mode, displayId:" + displayId,
+ Slog.w(TAG_AM, "Target display cannot be used for fixed mode, displayId:" + displayId,
new RuntimeException());
return false;
}
@@ -671,17 +672,17 @@
return false;
}
if (options == null) {
- Log.e(TAG_AM, "startFixedActivityModeForDisplayAndUser, null options");
+ Slog.e(TAG_AM, "startFixedActivityModeForDisplayAndUser, null options");
return false;
}
if (!isUserAllowedToLaunchActivity(userId)) {
- Log.e(TAG_AM, "startFixedActivityModeForDisplayAndUser, requested user:" + userId
+ Slog.e(TAG_AM, "startFixedActivityModeForDisplayAndUser, requested user:" + userId
+ " cannot launch activity, Intent:" + intent);
return false;
}
ComponentName component = intent.getComponent();
if (component == null) {
- Log.e(TAG_AM,
+ Slog.e(TAG_AM,
"startFixedActivityModeForDisplayAndUser: No component specified for "
+ "requested Intent"
+ intent);
diff --git a/service/src/com/android/car/cluster/InstrumentClusterService.java b/service/src/com/android/car/cluster/InstrumentClusterService.java
index 8a95eb3..cec1731 100644
--- a/service/src/com/android/car/cluster/InstrumentClusterService.java
+++ b/service/src/com/android/car/cluster/InstrumentClusterService.java
@@ -43,6 +43,7 @@
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
+import android.util.Slog;
import android.view.KeyEvent;
import com.android.car.AppFocusService;
@@ -114,14 +115,14 @@
IInstrumentClusterNavigation navigationBinder = getNavigationBinder(
/* retryOnFail= */ false);
if (navigationBinder == null) {
- Log.e(TAG, "onNavigationStateChanged failed, renderer not ready, Bundle:"
+ Slog.e(TAG, "onNavigationStateChanged failed, renderer not ready, Bundle:"
+ bundle);
return;
}
try {
navigationBinder.onNavigationStateChanged(bundle);
} catch (RemoteException e) {
- Log.e(TAG, "onNavigationStateChanged failed, bundle:" + bundle, e);
+ Slog.e(TAG, "onNavigationStateChanged failed, bundle:" + bundle, e);
}
}
@@ -139,7 +140,7 @@
try {
return navigationBinder.getInstrumentClusterInfo();
} catch (RemoteException e) {
- Log.e(TAG, "getInstrumentClusterInfo failed", e);
+ Slog.e(TAG, "getInstrumentClusterInfo failed", e);
}
}
throw new IllegalStateException("cannot access renderer service");
@@ -154,7 +155,7 @@
@Override
public void onServiceConnected(ComponentName name, IBinder binder) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "onServiceConnected, name: " + name + ", binder: " + binder);
+ Slog.d(TAG, "onServiceConnected, name: " + name + ", binder: " + binder);
}
IInstrumentCluster service = IInstrumentCluster.Stub.asInterface(binder);
ContextOwner navContextOwner;
@@ -171,7 +172,7 @@
@Override
public void onServiceDisconnected(ComponentName name) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "onServiceDisconnected, name: " + name);
+ Slog.d(TAG, "onServiceDisconnected, name: " + name);
}
mContext.unbindService(this);
synchronized (mLock) {
@@ -221,7 +222,7 @@
try {
mLock.wait(RENDERER_SERVICE_WAIT_TIMEOUT_MS);
} catch (InterruptedException e) {
- Log.d(TAG, "waitForRenderer, interrupted", e);
+ Slog.d(TAG, "waitForRenderer, interrupted", e);
Thread.currentThread().interrupt();
}
}
@@ -247,7 +248,7 @@
navigationBinder = renderer.getNavigationService();
break;
} catch (RemoteException e) {
- Log.e(TAG, "RemoteException from renderer", e);
+ Slog.e(TAG, "RemoteException from renderer", e);
renderer = null;
}
}
@@ -263,7 +264,7 @@
@Override
public void init() {
if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "init");
+ Slog.d(TAG, "init");
}
mAppFocusService.registerContextOwnerChangedCallback(this /* FocusOwnershipCallback */);
@@ -287,7 +288,7 @@
@Override
public void release() {
if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "release");
+ Slog.d(TAG, "release");
}
mAppFocusService.unregisterContextOwnerChangedCallback(this);
@@ -352,7 +353,7 @@
|| (!acquire && !Objects.equals(mNavContextOwner, requester))) {
// Nothing to do here. Either the same owner is acquiring twice, or someone is
// abandoning a focus they didn't have.
- Log.w(TAG, "Invalid nav context owner change (acquiring: " + acquire
+ Slog.w(TAG, "Invalid nav context owner change (acquiring: " + acquire
+ "), current owner: [" + mNavContextOwner
+ "], requester: [" + requester + "]");
return;
@@ -372,19 +373,19 @@
try {
service.setNavigationContextOwner(owner.uid, owner.pid);
} catch (RemoteException e) {
- Log.e(TAG, "Failed to call setNavigationContextOwner", e);
+ Slog.e(TAG, "Failed to call setNavigationContextOwner", e);
}
}
private boolean isRendererServiceEnabled() {
if (TextUtils.isEmpty(mRenderingServiceConfig)) {
- Log.d(TAG, "Instrument cluster renderer was not configured");
+ Slog.d(TAG, "Instrument cluster renderer was not configured");
return false;
}
boolean explicitlyDisabled = "true".equals(Settings.Global
.getString(mContext.getContentResolver(), DISABLE_INSTRUMENTATION_SERVICE));
if (explicitlyDisabled) {
- Log.i(TAG, "Instrument cluster renderer explicitly disabled by settings");
+ Slog.i(TAG, "Instrument cluster renderer explicitly disabled by settings");
return false;
}
return true;
@@ -395,7 +396,7 @@
return false;
}
- Log.d(TAG, "bindInstrumentClusterRendererService, component: " + mRenderingServiceConfig);
+ Slog.d(TAG, "bindInstrumentClusterRendererService, component: " + mRenderingServiceConfig);
Intent intent = new Intent();
intent.setComponent(ComponentName.unflattenFromString(mRenderingServiceConfig));
@@ -428,7 +429,7 @@
@Override
public void onKeyEvent(KeyEvent event) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "InstrumentClusterService#onKeyEvent: " + event);
+ Slog.d(TAG, "InstrumentClusterService#onKeyEvent: " + event);
}
IInstrumentCluster service = getInstrumentClusterRendererService();
@@ -436,7 +437,7 @@
try {
service.onKeyEvent(event);
} catch (RemoteException e) {
- Log.e(TAG, "onKeyEvent", e);
+ Slog.e(TAG, "onKeyEvent", e);
}
}
}
@@ -514,7 +515,7 @@
public void rebind() {
InstrumentClusterService service = mService.get();
if (service == null) {
- Log.i(TAG, "rebind null service");
+ Slog.i(TAG, "rebind null service");
return;
}
service.mRendererBound = service.bindInstrumentClusterRendererService();
@@ -530,20 +531,20 @@
public void handleMessage(Message msg) {
InstrumentClusterService service = mService.get();
if (service == null) {
- Log.i(TAG, "handleMessage null service");
+ Slog.i(TAG, "handleMessage null service");
return;
}
service.mRendererBound = service.bindInstrumentClusterRendererService();
if (service.mRendererBound) {
- Log.w(TAG, "Failed to bound to render service, next attempt in "
+ Slog.w(TAG, "Failed to bound to render service, next attempt in "
+ NEXT_REBIND_ATTEMPT_DELAY_MS + "ms.");
int attempts = msg.arg1;
if (--attempts >= 0) {
sendMessageDelayed(obtainMessage(0, attempts, 0), NEXT_REBIND_ATTEMPT_DELAY_MS);
} else {
- Log.wtf(TAG, "Failed to rebind with cluster rendering service");
+ Slog.wtf(TAG, "Failed to rebind with cluster rendering service");
}
}
}
diff --git a/service/src/com/android/car/garagemode/Controller.java b/service/src/com/android/car/garagemode/Controller.java
index 86d5c82..2568aa9 100644
--- a/service/src/com/android/car/garagemode/Controller.java
+++ b/service/src/com/android/car/garagemode/Controller.java
@@ -37,7 +37,7 @@
* Main controller for GarageMode. It controls all the flows of GarageMode and defines the logic.
*/
public class Controller implements CarPowerStateListenerWithCompletion {
- private static final Logger LOG = new Logger("Controller");
+ private static final Slogger LOG = new Slogger("Controller");
@VisibleForTesting final WakeupPolicy mWakeupPolicy;
private final GarageMode mGarageMode;
diff --git a/service/src/com/android/car/garagemode/GarageMode.java b/service/src/com/android/car/garagemode/GarageMode.java
index 1e26ffd..627c747 100644
--- a/service/src/com/android/car/garagemode/GarageMode.java
+++ b/service/src/com/android/car/garagemode/GarageMode.java
@@ -43,7 +43,7 @@
*/
class GarageMode {
- private static final Logger LOG = new Logger("GarageMode");
+ private static final Slogger LOG = new Slogger("GarageMode");
/**
* When changing this field value, please update
diff --git a/service/src/com/android/car/garagemode/GarageModeService.java b/service/src/com/android/car/garagemode/GarageModeService.java
index a095749..601a930 100644
--- a/service/src/com/android/car/garagemode/GarageModeService.java
+++ b/service/src/com/android/car/garagemode/GarageModeService.java
@@ -29,7 +29,7 @@
* Garage Mode enables idle time in cars.
*/
public class GarageModeService implements CarServiceBase {
- private static final Logger LOG = new Logger("Service");
+ private static final Slogger LOG = new Slogger("Service");
private final Context mContext;
private final Controller mController;
diff --git a/service/src/com/android/car/garagemode/Logger.java b/service/src/com/android/car/garagemode/Logger.java
deleted file mode 100644
index 220ee74..0000000
--- a/service/src/com/android/car/garagemode/Logger.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.car.garagemode;
-
-import android.util.Log;
-
-class Logger {
- private final String mTag;
- private final String mPrefix;
-
- Logger(String prefix) {
- mTag = "GarageMode";
- mPrefix = prefix;
- }
-
- /** Passing message further to Log.v() */
- public void v(String msg) {
- Log.v(mTag, buildMessage(msg));
- }
-
- /** Passing message further to Log.v() */
- public void v(String msg, Exception ex) {
- Log.v(mTag, buildMessage(msg), ex);
- }
-
- /** Passing message further to Log.i() */
- public void i(String msg) {
- Log.i(mTag, buildMessage(msg));
- }
-
- /** Passing message further to Log.i() */
- public void i(String msg, Exception ex) {
- Log.i(mTag, buildMessage(msg), ex);
- }
-
- /** Passing message further to Log.d() */
- public void d(String msg) {
- Log.d(mTag, buildMessage(msg));
- }
-
- /** Passing message further to Log.d() */
- public void d(String msg, Exception ex) {
- Log.d(mTag, buildMessage(msg), ex);
- }
-
- /** Passing message further to Log.w() */
- public void w(String msg, Exception ex) {
- Log.w(mTag, buildMessage(msg), ex);
- }
-
- /** Passing message further to Log.w() */
- public void w(String msg) {
- Log.w(mTag, buildMessage(msg));
- }
-
- /** Passing message further to Log.e() */
- public void e(String msg) {
- Log.e(mTag, buildMessage(msg));
- }
-
- /** Passing message further to Log.e() */
- public void e(String msg, Exception ex) {
- Log.e(mTag, buildMessage(msg), ex);
- }
-
- /** Passing message further to Log.e() */
- public void e(String msg, Throwable ex) {
- Log.e(mTag, buildMessage(msg), ex);
- }
-
- private String buildMessage(String msg) {
- return String.format("[%s]: %s", mPrefix, msg);
- }
-}
diff --git a/service/src/com/android/car/garagemode/Slogger.java b/service/src/com/android/car/garagemode/Slogger.java
new file mode 100644
index 0000000..bdc8766
--- /dev/null
+++ b/service/src/com/android/car/garagemode/Slogger.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.car.garagemode;
+
+import android.util.Slog;
+
+class Slogger {
+ private final String mTag;
+ private final String mPrefix;
+
+ Slogger(String prefix) {
+ mTag = "GarageMode";
+ mPrefix = prefix;
+ }
+
+ /** Passing message further to Slog.v() */
+ public void v(String msg) {
+ Slog.v(mTag, buildMessage(msg));
+ }
+
+ /** Passing message further to Slog.v() */
+ public void v(String msg, Exception ex) {
+ Slog.v(mTag, buildMessage(msg), ex);
+ }
+
+ /** Passing message further to Slog.i() */
+ public void i(String msg) {
+ Slog.i(mTag, buildMessage(msg));
+ }
+
+ /** Passing message further to Slog.i() */
+ public void i(String msg, Exception ex) {
+ Slog.i(mTag, buildMessage(msg), ex);
+ }
+
+ /** Passing message further to Slog.d() */
+ public void d(String msg) {
+ Slog.d(mTag, buildMessage(msg));
+ }
+
+ /** Passing message further to Slog.d() */
+ public void d(String msg, Exception ex) {
+ Slog.d(mTag, buildMessage(msg), ex);
+ }
+
+ /** Passing message further to Slog.w() */
+ public void w(String msg, Exception ex) {
+ Slog.w(mTag, buildMessage(msg), ex);
+ }
+
+ /** Passing message further to Slog.w() */
+ public void w(String msg) {
+ Slog.w(mTag, buildMessage(msg));
+ }
+
+ /** Passing message further to Slog.e() */
+ public void e(String msg) {
+ Slog.e(mTag, buildMessage(msg));
+ }
+
+ /** Passing message further to Slog.e() */
+ public void e(String msg, Exception ex) {
+ Slog.e(mTag, buildMessage(msg), ex);
+ }
+
+ /** Passing message further to Slog.e() */
+ public void e(String msg, Throwable ex) {
+ Slog.e(mTag, buildMessage(msg), ex);
+ }
+
+ private String buildMessage(String msg) {
+ return String.format("[%s]: %s", mPrefix, msg);
+ }
+}
diff --git a/service/src/com/android/car/garagemode/WakeupPolicy.java b/service/src/com/android/car/garagemode/WakeupPolicy.java
index b049554..4e3e532 100644
--- a/service/src/com/android/car/garagemode/WakeupPolicy.java
+++ b/service/src/com/android/car/garagemode/WakeupPolicy.java
@@ -32,7 +32,7 @@
* week. After that, wake up every 7 days for a month, and wake up every 30 days thereafter.
*/
class WakeupPolicy {
- private static final Logger LOG = new Logger("WakeupPolicy");
+ private static final Slogger LOG = new Slogger("WakeupPolicy");
private static final Map<Character, Integer> TIME_UNITS_LOOKUP_SEC;
static {
TIME_UNITS_LOOKUP_SEC = new HashMap<>();
diff --git a/service/src/com/android/car/hal/DiagnosticHalService.java b/service/src/com/android/car/hal/DiagnosticHalService.java
index 5e85021..bf0a7f2 100644
--- a/service/src/com/android/car/hal/DiagnosticHalService.java
+++ b/service/src/com/android/car/hal/DiagnosticHalService.java
@@ -29,7 +29,7 @@
import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
import android.hardware.automotive.vehicle.V2_0.VehiclePropertyChangeMode;
import android.os.ServiceSpecificException;
-import android.util.Log;
+import android.util.Slog;
import android.util.SparseArray;
import com.android.car.CarLog;
@@ -129,13 +129,13 @@
@Override
public void takeProperties(Collection<VehiclePropConfig> properties) {
if (DEBUG) {
- Log.d(CarLog.TAG_DIAGNOSTIC, "takeSupportedProperties");
+ Slog.d(CarLog.TAG_DIAGNOSTIC, "takeSupportedProperties");
}
for (VehiclePropConfig vp : properties) {
int sensorType = getTokenForProperty(vp);
if (sensorType == NOT_SUPPORTED_PROPERTY) {
if (DEBUG) {
- Log.d(CarLog.TAG_DIAGNOSTIC, new StringBuilder()
+ Slog.d(CarLog.TAG_DIAGNOSTIC, new StringBuilder()
.append("0x")
.append(toHexString(vp.prop))
.append(" ignored")
@@ -161,13 +161,13 @@
case VehicleProperty.OBD2_LIVE_FRAME:
mDiagnosticCapabilities.setSupported(propConfig.prop);
mVehiclePropertyToConfig.put(propConfig.prop, propConfig);
- Log.i(CarLog.TAG_DIAGNOSTIC, "configArray for OBD2_LIVE_FRAME is "
+ Slog.i(CarLog.TAG_DIAGNOSTIC, "configArray for OBD2_LIVE_FRAME is "
+ propConfig.configArray);
return CarDiagnosticManager.FRAME_TYPE_LIVE;
case VehicleProperty.OBD2_FREEZE_FRAME:
mDiagnosticCapabilities.setSupported(propConfig.prop);
mVehiclePropertyToConfig.put(propConfig.prop, propConfig);
- Log.i(CarLog.TAG_DIAGNOSTIC, "configArray for OBD2_FREEZE_FRAME is "
+ Slog.i(CarLog.TAG_DIAGNOSTIC, "configArray for OBD2_FREEZE_FRAME is "
+ propConfig.configArray);
return CarDiagnosticManager.FRAME_TYPE_FREEZE;
case VehicleProperty.OBD2_FREEZE_FRAME_INFO:
@@ -175,10 +175,10 @@
return propConfig.prop;
case VehicleProperty.OBD2_FREEZE_FRAME_CLEAR:
mDiagnosticCapabilities.setSupported(propConfig.prop);
- Log.i(CarLog.TAG_DIAGNOSTIC, "configArray for OBD2_FREEZE_FRAME_CLEAR is "
+ Slog.i(CarLog.TAG_DIAGNOSTIC, "configArray for OBD2_FREEZE_FRAME_CLEAR is "
+ propConfig.configArray);
if (propConfig.configArray.size() < 1) {
- Log.e(CarLog.TAG_DIAGNOSTIC, String.format(
+ Slog.e(CarLog.TAG_DIAGNOSTIC, String.format(
"property 0x%x does not specify whether it supports selective "
+ "clearing of freeze frames. assuming it does not.",
propConfig.prop));
@@ -196,7 +196,7 @@
@Override
public void init() {
if (DEBUG) {
- Log.d(CarLog.TAG_DIAGNOSTIC, "init()");
+ Slog.d(CarLog.TAG_DIAGNOSTIC, "init()");
}
synchronized (mLock) {
mIsReady = true;
@@ -248,14 +248,14 @@
propConfig = mSensorTypeToConfig.get(sensorType);
}
if (propConfig == null) {
- Log.e(CarLog.TAG_DIAGNOSTIC, new StringBuilder()
+ Slog.e(CarLog.TAG_DIAGNOSTIC, new StringBuilder()
.append("VehiclePropConfig not found, propertyId: 0x")
.append(toHexString(propConfig.prop))
.toString());
return false;
}
if (DEBUG) {
- Log.d(CarLog.TAG_DIAGNOSTIC, new StringBuilder()
+ Slog.d(CarLog.TAG_DIAGNOSTIC, new StringBuilder()
.append("requestDiagnosticStart, propertyId: 0x")
.append(toHexString(propConfig.prop))
.append(", rate: ")
@@ -277,14 +277,14 @@
propConfig = mSensorTypeToConfig.get(sensorType);
}
if (propConfig == null) {
- Log.e(CarLog.TAG_DIAGNOSTIC, new StringBuilder()
+ Slog.e(CarLog.TAG_DIAGNOSTIC, new StringBuilder()
.append("VehiclePropConfig not found, propertyId: 0x")
.append(toHexString(propConfig.prop))
.toString());
return;
}
if (DEBUG) {
- Log.d(CarLog.TAG_DIAGNOSTIC, new StringBuilder()
+ Slog.d(CarLog.TAG_DIAGNOSTIC, new StringBuilder()
.append("requestDiagnosticStop, propertyId: 0x")
.append(toHexString(propConfig.prop))
.toString());
@@ -305,7 +305,7 @@
propConfig = mSensorTypeToConfig.get(sensorType);
}
if (propConfig == null) {
- Log.e(CarLog.TAG_DIAGNOSTIC, new StringBuilder()
+ Slog.e(CarLog.TAG_DIAGNOSTIC, new StringBuilder()
.append("property not available 0x")
.append(toHexString(propConfig.prop))
.toString());
@@ -314,7 +314,7 @@
try {
return mVehicleHal.get(propConfig.prop);
} catch (ServiceSpecificException e) {
- Log.e(CarLog.TAG_DIAGNOSTIC,
+ Slog.e(CarLog.TAG_DIAGNOSTIC,
"property not ready 0x" + toHexString(propConfig.prop), e);
return null;
}
@@ -338,7 +338,7 @@
int count = DiagnosticIntegerSensorIndex.LAST_SYSTEM_INDEX + 1;
List<Integer> configArray = getPropConfigArray(halPropId);
if (configArray.size() < 2) {
- Log.e(CarLog.TAG_DIAGNOSTIC, String.format(
+ Slog.e(CarLog.TAG_DIAGNOSTIC, String.format(
"property 0x%x does not specify the number of vendor-specific properties."
+ "assuming 0.", halPropId));
} else {
@@ -351,7 +351,7 @@
int count = DiagnosticFloatSensorIndex.LAST_SYSTEM_INDEX + 1;
List<Integer> configArray = getPropConfigArray(halPropId);
if (configArray.size() < 2) {
- Log.e(CarLog.TAG_DIAGNOSTIC, String.format(
+ Slog.e(CarLog.TAG_DIAGNOSTIC, String.format(
"property 0x%x does not specify the number of vendor-specific properties."
+ "assuming 0.", halPropId));
} else {
@@ -481,10 +481,10 @@
VehiclePropValue value = mVehicleHal.get(VehicleProperty.OBD2_LIVE_FRAME);
return createCarDiagnosticEvent(value);
} catch (ServiceSpecificException e) {
- Log.e(CarLog.TAG_DIAGNOSTIC, "Failed to read OBD2_LIVE_FRAME.", e);
+ Slog.e(CarLog.TAG_DIAGNOSTIC, "Failed to read OBD2_LIVE_FRAME.", e);
return null;
} catch (IllegalArgumentException e) {
- Log.e(CarLog.TAG_DIAGNOSTIC, "illegal argument trying to read OBD2_LIVE_FRAME", e);
+ Slog.e(CarLog.TAG_DIAGNOSTIC, "illegal argument trying to read OBD2_LIVE_FRAME", e);
return null;
}
}
@@ -502,10 +502,10 @@
}
return timestamps;
} catch (ServiceSpecificException e) {
- Log.e(CarLog.TAG_DIAGNOSTIC, "Failed to read OBD2_FREEZE_FRAME_INFO.", e);
+ Slog.e(CarLog.TAG_DIAGNOSTIC, "Failed to read OBD2_FREEZE_FRAME_INFO.", e);
return null;
} catch (IllegalArgumentException e) {
- Log.e(CarLog.TAG_DIAGNOSTIC,
+ Slog.e(CarLog.TAG_DIAGNOSTIC,
"illegal argument trying to read OBD2_FREEZE_FRAME_INFO", e);
return null;
}
@@ -524,10 +524,10 @@
VehiclePropValue value = mVehicleHal.get(builder.build());
return createCarDiagnosticEvent(value);
} catch (ServiceSpecificException e) {
- Log.e(CarLog.TAG_DIAGNOSTIC, "Failed to read OBD2_FREEZE_FRAME.", e);
+ Slog.e(CarLog.TAG_DIAGNOSTIC, "Failed to read OBD2_FREEZE_FRAME.", e);
return null;
} catch (IllegalArgumentException e) {
- Log.e(CarLog.TAG_DIAGNOSTIC,
+ Slog.e(CarLog.TAG_DIAGNOSTIC,
"illegal argument trying to read OBD2_FREEZE_FRAME", e);
return null;
}
@@ -543,9 +543,9 @@
try {
mVehicleHal.set(builder.build());
} catch (ServiceSpecificException e) {
- Log.e(CarLog.TAG_DIAGNOSTIC, "Failed to write OBD2_FREEZE_FRAME_CLEAR.", e);
+ Slog.e(CarLog.TAG_DIAGNOSTIC, "Failed to write OBD2_FREEZE_FRAME_CLEAR.", e);
} catch (IllegalArgumentException e) {
- Log.e(CarLog.TAG_DIAGNOSTIC,
+ Slog.e(CarLog.TAG_DIAGNOSTIC,
"illegal argument trying to write OBD2_FREEZE_FRAME_CLEAR", e);
}
}
diff --git a/service/src/com/android/car/hal/HalClient.java b/service/src/com/android/car/hal/HalClient.java
index e7d3e7b..721a804 100644
--- a/service/src/com/android/car/hal/HalClient.java
+++ b/service/src/com/android/car/hal/HalClient.java
@@ -29,7 +29,7 @@
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceSpecificException;
-import android.util.Log;
+import android.util.Slog;
import com.android.car.CarLog;
import com.android.internal.annotations.VisibleForTesting;
@@ -99,7 +99,7 @@
try {
return mVehicle.set(propValue);
} catch (RemoteException e) {
- Log.e(TAG, getValueErrorMessage("set", propValue), e);
+ Slog.e(TAG, getValueErrorMessage("set", propValue), e);
return StatusCode.TRY_AGAIN;
}
}, mWaitCapMs, mSleepMs);
@@ -109,7 +109,7 @@
}
if (StatusCode.OK != status) {
- Log.e(TAG, getPropertyErrorMessage("set", propValue, status));
+ Slog.e(TAG, getPropertyErrorMessage("set", propValue, status));
throw new ServiceSpecificException(status,
"Failed to set property: 0x" + Integer.toHexString(propValue.prop)
+ " in areaId: 0x" + Integer.toHexString(propValue.areaId));
@@ -145,7 +145,7 @@
if (StatusCode.OK == status) {
status = StatusCode.NOT_AVAILABLE;
}
- Log.e(TAG, getPropertyErrorMessage("get", requestedPropValue, status));
+ Slog.e(TAG, getPropertyErrorMessage("get", requestedPropValue, status));
throw new ServiceSpecificException(status,
"Failed to get property: 0x" + Integer.toHexString(requestedPropValue.prop)
+ " in areaId: 0x" + Integer.toHexString(requestedPropValue.areaId));
@@ -163,7 +163,7 @@
result.propValue = propValue;
});
} catch (RemoteException e) {
- Log.e(TAG, getValueErrorMessage("get", requestedPropValue), e);
+ Slog.e(TAG, getValueErrorMessage("get", requestedPropValue), e);
result.status = StatusCode.TRY_AGAIN;
}
@@ -180,21 +180,21 @@
long startTime = elapsedRealtime();
while (StatusCode.TRY_AGAIN == status && (elapsedRealtime() - startTime) < timeoutMs) {
if (DEBUG) {
- Log.d(TAG, "Status before sleeping " + sleepMs + "ms: "
+ Slog.d(TAG, "Status before sleeping " + sleepMs + "ms: "
+ StatusCode.toString(status));
}
try {
Thread.sleep(sleepMs);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
- Log.e(TAG, "Thread was interrupted while waiting for vehicle HAL.", e);
+ Slog.e(TAG, "Thread was interrupted while waiting for vehicle HAL.", e);
break;
}
status = callback.action();
- if (DEBUG) Log.d(TAG, "Status after waking up: " + StatusCode.toString(status));
+ if (DEBUG) Slog.d(TAG, "Status after waking up: " + StatusCode.toString(status));
}
- if (DEBUG) Log.d(TAG, "Returning status: " + StatusCode.toString(status));
+ if (DEBUG) Slog.d(TAG, "Returning status: " + StatusCode.toString(status));
return status;
}
@@ -235,7 +235,7 @@
public void handleMessage(Message msg) {
IVehicleCallback callback = mCallback.get();
if (callback == null) {
- Log.i(TAG, "handleMessage null callback");
+ Slog.i(TAG, "handleMessage null callback");
return;
}
@@ -252,10 +252,10 @@
callback.onPropertySetError(obj.errorCode, obj.propId, obj.areaId);
break;
default:
- Log.e(TAG, "Unexpected message: " + msg.what);
+ Slog.e(TAG, "Unexpected message: " + msg.what);
}
} catch (RemoteException e) {
- Log.e(TAG, "Message failed: " + msg.what);
+ Slog.e(TAG, "Message failed: " + msg.what);
}
}
}
diff --git a/service/src/com/android/car/hal/HalServiceBase.java b/service/src/com/android/car/hal/HalServiceBase.java
index c343866..01263ce 100644
--- a/service/src/com/android/car/hal/HalServiceBase.java
+++ b/service/src/com/android/car/hal/HalServiceBase.java
@@ -20,7 +20,7 @@
import android.annotation.NonNull;
import android.hardware.automotive.vehicle.V2_0.VehiclePropConfig;
import android.hardware.automotive.vehicle.V2_0.VehiclePropValue;
-import android.util.Log;
+import android.util.Slog;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -90,7 +90,7 @@
* Handles errors and pass error codes when setting properties.
*/
public void onPropertySetError(int property, int area, int errorCode) {
- Log.d(MY_TAG, getClass().getSimpleName() + ".onPropertySetError(): property=" + property
+ Slog.d(MY_TAG, getClass().getSimpleName() + ".onPropertySetError(): property=" + property
+ ", area=" + area + " , errorCode = " + errorCode);
}
diff --git a/service/src/com/android/car/hal/InputHalService.java b/service/src/com/android/car/hal/InputHalService.java
index 32e4d25..03e1ebd 100644
--- a/service/src/com/android/car/hal/InputHalService.java
+++ b/service/src/com/android/car/hal/InputHalService.java
@@ -33,7 +33,7 @@
import android.hardware.automotive.vehicle.V2_0.VehiclePropConfig;
import android.hardware.automotive.vehicle.V2_0.VehiclePropValue;
import android.os.SystemClock;
-import android.util.Log;
+import android.util.Slog;
import android.util.SparseArray;
import android.view.Display;
import android.view.InputDevice;
@@ -126,7 +126,7 @@
boolean customInputSupported;
synchronized (mLock) {
if (!mKeyInputSupported && !mRotaryInputSupported && !mCustomInputSupported) {
- Log.w(CarLog.TAG_INPUT,
+ Slog.w(CarLog.TAG_INPUT,
"input listener set while rotary and key input not supported");
return;
}
@@ -216,7 +216,7 @@
listener = mListener;
}
if (listener == null) {
- Log.w(CarLog.TAG_INPUT, "Input event while listener is null");
+ Slog.w(CarLog.TAG_INPUT, "Input event while listener is null");
return;
}
for (VehiclePropValue value : values) {
@@ -231,7 +231,7 @@
dispatchCustomInput(listener, value);
break;
default:
- Log.e(CarLog.TAG_INPUT,
+ Slog.e(CarLog.TAG_INPUT,
"Wrong event dispatched, prop:0x" + Integer.toHexString(value.prop));
break;
}
@@ -246,7 +246,7 @@
int vehicleDisplay = value.value.int32Values.get(2);
int indentsCount = value.value.int32Values.size() < 4 ? 1 : value.value.int32Values.get(3);
if (DBG) {
- Log.i(CarLog.TAG_INPUT, new StringBuilder()
+ Slog.i(CarLog.TAG_INPUT, new StringBuilder()
.append("hal event code:").append(code)
.append(", action:").append(action)
.append(", display: ").append(vehicleDisplay)
@@ -262,7 +262,7 @@
private void dispatchRotaryInput(InputListener listener, VehiclePropValue value) {
int timeValuesIndex = 3; // remaining values are time deltas in nanoseconds
if (value.value.int32Values.size() < timeValuesIndex) {
- Log.e(CarLog.TAG_INPUT, "Wrong int32 array size for RotaryInput from vhal:"
+ Slog.e(CarLog.TAG_INPUT, "Wrong int32 array size for RotaryInput from vhal:"
+ value.value.int32Values.size());
return;
}
@@ -271,7 +271,7 @@
int vehicleDisplay = value.value.int32Values.get(2);
long timestamp = value.timestamp; // for first detent, uptime nanoseconds
if (DBG) {
- Log.i(CarLog.TAG_INPUT, new StringBuilder()
+ Slog.i(CarLog.TAG_INPUT, new StringBuilder()
.append("hal rotary input type: ").append(rotaryInputType)
.append(", number of detents:").append(detentCount)
.append(", display: ").append(vehicleDisplay)
@@ -280,17 +280,17 @@
boolean clockwise = detentCount > 0;
detentCount = Math.abs(detentCount);
if (detentCount == 0) { // at least there should be one event
- Log.e(CarLog.TAG_INPUT, "Zero detentCount from vhal, ignore the event");
+ Slog.e(CarLog.TAG_INPUT, "Zero detentCount from vhal, ignore the event");
return;
}
if (vehicleDisplay != VehicleDisplay.MAIN
&& vehicleDisplay != VehicleDisplay.INSTRUMENT_CLUSTER) {
- Log.e(CarLog.TAG_INPUT, "Wrong display type for RotaryInput from vhal:"
+ Slog.e(CarLog.TAG_INPUT, "Wrong display type for RotaryInput from vhal:"
+ vehicleDisplay);
return;
}
if (value.value.int32Values.size() != (timeValuesIndex + detentCount - 1)) {
- Log.e(CarLog.TAG_INPUT, "Wrong int32 array size for RotaryInput from vhal:"
+ Slog.e(CarLog.TAG_INPUT, "Wrong int32 array size for RotaryInput from vhal:"
+ value.value.int32Values.size());
return;
}
@@ -303,7 +303,7 @@
carInputManagerType = CarInputManager.INPUT_TYPE_ROTARY_VOLUME;
break;
default:
- Log.e(CarLog.TAG_INPUT, "Unknown rotary input type: " + rotaryInputType);
+ Slog.e(CarLog.TAG_INPUT, "Unknown rotary input type: " + rotaryInputType);
return;
}
@@ -390,7 +390,7 @@
private void dispatchCustomInput(InputListener listener, VehiclePropValue value) {
if (DBG) {
- Log.d(CarLog.TAG_INPUT, "Dispatching CustomInputEvent for listener="
+ Slog.d(CarLog.TAG_INPUT, "Dispatching CustomInputEvent for listener="
+ listener + " and value=" + value);
}
int inputCode = value.value.int32Values.get(0);
@@ -398,7 +398,7 @@
int repeatCounter = value.value.int32Values.get(2);
if (inputCode < CUSTOM_EVENT_F1 || inputCode > CUSTOM_EVENT_F10) {
- Log.e(CarLog.TAG_INPUT, "Unknown custom input code: " + inputCode);
+ Slog.e(CarLog.TAG_INPUT, "Unknown custom input code: " + inputCode);
return;
}
CustomInputEvent event = new CustomInputEvent(inputCode, targetDisplayType, repeatCounter);
diff --git a/service/src/com/android/car/hal/PowerHalService.java b/service/src/com/android/car/hal/PowerHalService.java
index 14607e5..d95e766 100644
--- a/service/src/com/android/car/hal/PowerHalService.java
+++ b/service/src/com/android/car/hal/PowerHalService.java
@@ -30,7 +30,7 @@
import android.hardware.automotive.vehicle.V2_0.VehiclePropValue;
import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
import android.os.ServiceSpecificException;
-import android.util.Log;
+import android.util.Slog;
import com.android.car.CarLog;
import com.android.internal.annotations.GuardedBy;
@@ -225,7 +225,7 @@
* Send WaitForVhal message to VHAL
*/
public void sendWaitForVhal() {
- Log.i(CarLog.TAG_POWER, "send wait for vhal");
+ Slog.i(CarLog.TAG_POWER, "send wait for vhal");
setPowerState(VehicleApPowerStateReport.WAIT_FOR_VHAL, 0);
}
@@ -234,7 +234,7 @@
* @param wakeupTimeSec Notify VHAL when system wants to be woken from sleep.
*/
public void sendSleepEntry(int wakeupTimeSec) {
- Log.i(CarLog.TAG_POWER, "send sleep entry");
+ Slog.i(CarLog.TAG_POWER, "send sleep entry");
setPowerState(VehicleApPowerStateReport.DEEP_SLEEP_ENTRY, wakeupTimeSec);
}
@@ -243,7 +243,7 @@
* Notifies VHAL when SOC has woken.
*/
public void sendSleepExit() {
- Log.i(CarLog.TAG_POWER, "send sleep exit");
+ Slog.i(CarLog.TAG_POWER, "send sleep exit");
setPowerState(VehicleApPowerStateReport.DEEP_SLEEP_EXIT, 0);
}
@@ -251,7 +251,7 @@
* Send Shutdown Postpone message to VHAL
*/
public void sendShutdownPostpone(int postponeTimeMs) {
- Log.i(CarLog.TAG_POWER, "send shutdown postpone, time:" + postponeTimeMs);
+ Slog.i(CarLog.TAG_POWER, "send shutdown postpone, time:" + postponeTimeMs);
setPowerState(VehicleApPowerStateReport.SHUTDOWN_POSTPONE, postponeTimeMs);
}
@@ -259,7 +259,7 @@
* Send Shutdown Start message to VHAL
*/
public void sendShutdownStart(int wakeupTimeSec) {
- Log.i(CarLog.TAG_POWER, "send shutdown start");
+ Slog.i(CarLog.TAG_POWER, "send shutdown start");
setPowerState(VehicleApPowerStateReport.SHUTDOWN_START, wakeupTimeSec);
}
@@ -267,7 +267,7 @@
* Send On message to VHAL
*/
public void sendOn() {
- Log.i(CarLog.TAG_POWER, "send on");
+ Slog.i(CarLog.TAG_POWER, "send on");
setPowerState(VehicleApPowerStateReport.ON, 0);
}
@@ -275,7 +275,7 @@
* Send Shutdown Prepare message to VHAL
*/
public void sendShutdownPrepare() {
- Log.i(CarLog.TAG_POWER, "send shutdown prepare");
+ Slog.i(CarLog.TAG_POWER, "send shutdown prepare");
setPowerState(VehicleApPowerStateReport.SHUTDOWN_PREPARE, 0);
}
@@ -283,7 +283,7 @@
* Send Shutdown Cancel message to VHAL
*/
public void sendShutdownCancel() {
- Log.i(CarLog.TAG_POWER, "send shutdown cancel");
+ Slog.i(CarLog.TAG_POWER, "send shutdown cancel");
setPowerState(VehicleApPowerStateReport.SHUTDOWN_CANCELLED, 0);
}
@@ -303,9 +303,9 @@
}
try {
mHal.set(VehicleProperty.DISPLAY_BRIGHTNESS, 0).to(brightness);
- Log.i(CarLog.TAG_POWER, "send display brightness = " + brightness);
+ Slog.i(CarLog.TAG_POWER, "send display brightness = " + brightness);
} catch (ServiceSpecificException | IllegalArgumentException e) {
- Log.e(CarLog.TAG_POWER, "cannot set DISPLAY_BRIGHTNESS", e);
+ Slog.e(CarLog.TAG_POWER, "cannot set DISPLAY_BRIGHTNESS", e);
}
}
@@ -314,10 +314,10 @@
int[] values = { state, additionalParam };
try {
mHal.set(VehicleProperty.AP_POWER_STATE_REPORT, 0).to(values);
- Log.i(CarLog.TAG_POWER, "setPowerState=" + powerStateReportName(state)
+ Slog.i(CarLog.TAG_POWER, "setPowerState=" + powerStateReportName(state)
+ " param=" + additionalParam);
} catch (ServiceSpecificException e) {
- Log.e(CarLog.TAG_POWER, "cannot set to AP_POWER_STATE_REPORT", e);
+ Slog.e(CarLog.TAG_POWER, "cannot set to AP_POWER_STATE_REPORT", e);
}
}
}
@@ -331,7 +331,7 @@
try {
state = mHal.get(int[].class, VehicleProperty.AP_POWER_STATE_REQ);
} catch (ServiceSpecificException e) {
- Log.e(CarLog.TAG_POWER, "Cannot get AP_POWER_STATE_REQ", e);
+ Slog.e(CarLog.TAG_POWER, "Cannot get AP_POWER_STATE_REQ", e);
return null;
}
return new PowerState(state[VehicleApPowerStateReqIndex.STATE],
@@ -381,7 +381,7 @@
mMaxDisplayBrightness = brightnessProperty.areaConfigs.size() > 0
? brightnessProperty.areaConfigs.get(0).maxInt32Value : 0;
if (mMaxDisplayBrightness <= 0) {
- Log.w(CarLog.TAG_POWER, "Max display brightness from vehicle HAL is invalid:"
+ Slog.w(CarLog.TAG_POWER, "Max display brightness from vehicle HAL is invalid:"
+ mMaxDisplayBrightness);
mMaxDisplayBrightness = 1;
}
@@ -438,7 +438,7 @@
case AP_POWER_STATE_REQ:
int state = v.value.int32Values.get(VehicleApPowerStateReqIndex.STATE);
int param = v.value.int32Values.get(VehicleApPowerStateReqIndex.ADDITIONAL);
- Log.i(CarLog.TAG_POWER, "Received AP_POWER_STATE_REQ="
+ Slog.i(CarLog.TAG_POWER, "Received AP_POWER_STATE_REQ="
+ powerStateReqName(state) + " param=" + param);
listener.onApPowerStateChange(new PowerState(state, param));
break;
@@ -450,14 +450,15 @@
}
int brightness = v.value.int32Values.get(0) * MAX_BRIGHTNESS / maxBrightness;
if (brightness < 0) {
- Log.e(CarLog.TAG_POWER, "invalid brightness: " + brightness + ", set to 0");
+ Slog.e(CarLog.TAG_POWER, "invalid brightness: " + brightness
+ + ", set to 0");
brightness = 0;
} else if (brightness > MAX_BRIGHTNESS) {
- Log.e(CarLog.TAG_POWER, "invalid brightness: " + brightness + ", set to "
+ Slog.e(CarLog.TAG_POWER, "invalid brightness: " + brightness + ", set to "
+ MAX_BRIGHTNESS);
brightness = MAX_BRIGHTNESS;
}
- Log.i(CarLog.TAG_POWER, "Received DISPLAY_BRIGHTNESS=" + brightness);
+ Slog.i(CarLog.TAG_POWER, "Received DISPLAY_BRIGHTNESS=" + brightness);
listener.onDisplayBrightnessChange(brightness);
}
break;
diff --git a/service/src/com/android/car/hal/PropertyHalService.java b/service/src/com/android/car/hal/PropertyHalService.java
index 15038cd..09fe1f4 100644
--- a/service/src/com/android/car/hal/PropertyHalService.java
+++ b/service/src/com/android/car/hal/PropertyHalService.java
@@ -33,7 +33,7 @@
import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
import android.hardware.automotive.vehicle.V2_0.VehiclePropertyType;
import android.os.Build;
-import android.util.Log;
+import android.util.Slog;
import android.util.SparseArray;
import com.android.car.CarServiceUtils;
@@ -123,7 +123,7 @@
mSubscribedHalPropIds = new HashSet<Integer>();
mVehicleHal = vehicleHal;
if (mDbg) {
- Log.d(TAG, "started PropertyHalService");
+ Slog.d(TAG, "started PropertyHalService");
}
}
@@ -143,7 +143,7 @@
*/
public Map<Integer, CarPropertyConfig<?>> getPropertyList() {
if (mDbg) {
- Log.d(TAG, "getPropertyList");
+ Slog.d(TAG, "getPropertyList");
}
synchronized (mLock) {
if (mMgrPropIdToCarPropConfig.size() == 0) {
@@ -259,7 +259,7 @@
*/
public void subscribeProperty(int mgrPropId, float rate) {
if (mDbg) {
- Log.d(TAG, "subscribeProperty propId=0x" + toHexString(mgrPropId) + ", rate=" + rate);
+ Slog.d(TAG, "subscribeProperty propId=0x" + toHexString(mgrPropId) + ", rate=" + rate);
}
int halPropId = managerToHalPropId(mgrPropId);
if (!isPropertySupportedInVehicle(halPropId)) {
@@ -285,7 +285,7 @@
*/
public void unsubscribeProperty(int mgrPropId) {
if (mDbg) {
- Log.d(TAG, "unsubscribeProperty propId=0x" + toHexString(mgrPropId));
+ Slog.d(TAG, "unsubscribeProperty propId=0x" + toHexString(mgrPropId));
}
int halPropId = managerToHalPropId(mgrPropId);
if (!isPropertySupportedInVehicle(halPropId)) {
@@ -303,14 +303,14 @@
@Override
public void init() {
if (mDbg) {
- Log.d(TAG, "init()");
+ Slog.d(TAG, "init()");
}
}
@Override
public void release() {
if (mDbg) {
- Log.d(TAG, "release()");
+ Slog.d(TAG, "release()");
}
synchronized (mLock) {
for (Integer halProp : mSubscribedHalPropIds) {
@@ -341,12 +341,12 @@
mHalPropIdToVehiclePropConfig.put(p.prop, p);
}
if (mDbg) {
- Log.d(TAG, "takeSupportedProperties: " + toHexString(p.prop));
+ Slog.d(TAG, "takeSupportedProperties: " + toHexString(p.prop));
}
}
}
if (mDbg) {
- Log.d(TAG, "takeSupportedProperties() took " + allProperties.size()
+ Slog.d(TAG, "takeSupportedProperties() took " + allProperties.size()
+ " properties");
}
// If vehicle hal support to select permission for vendor properties.
@@ -372,12 +372,12 @@
continue;
}
if (!isPropertySupportedInVehicle(v.prop)) {
- Log.e(TAG, "Property is not supported: 0x" + toHexString(v.prop));
+ Slog.e(TAG, "Property is not supported: 0x" + toHexString(v.prop));
continue;
}
// Check payload if it is a userdebug build.
if (Build.IS_DEBUGGABLE && !mPropIds.checkPayload(v)) {
- Log.e(TAG, "Drop event for property: " + v + " because it is failed "
+ Slog.e(TAG, "Drop event for property: " + v + " because it is failed "
+ "in payload checking.");
continue;
}
diff --git a/service/src/com/android/car/hal/PropertyHalServiceIds.java b/service/src/com/android/car/hal/PropertyHalServiceIds.java
index 97c2633..8ffbe41 100644
--- a/service/src/com/android/car/hal/PropertyHalServiceIds.java
+++ b/service/src/com/android/car/hal/PropertyHalServiceIds.java
@@ -39,8 +39,8 @@
import android.hardware.automotive.vehicle.V2_0.VehicleSeatOccupancyState;
import android.hardware.automotive.vehicle.V2_0.VehicleTurnSignal;
import android.hardware.automotive.vehicle.V2_0.VehicleUnit;
-import android.util.Log;
import android.util.Pair;
+import android.util.Slog;
import android.util.SparseArray;
import java.lang.reflect.Field;
@@ -585,7 +585,7 @@
if (p != null) {
// Property ID exists. Return read permission.
if (p.first == null) {
- Log.e(TAG, "propId is not available for reading : 0x" + toHexString(propId));
+ Slog.e(TAG, "propId is not available for reading : 0x" + toHexString(propId));
}
return p.first;
} else if (isVendorProperty(propId)) {
@@ -607,7 +607,7 @@
if (p != null) {
// Property ID exists. Return write permission.
if (p.second == null) {
- Log.e(TAG, "propId is not writable : 0x" + toHexString(propId));
+ Slog.e(TAG, "propId is not writable : 0x" + toHexString(propId));
}
return p.second;
} else if (isVendorProperty(propId)) {
@@ -765,7 +765,7 @@
return true;
}
if (!checkFormatForAllProperties(propValue)) {
- Log.e(TAG, "Property value" + propValue + "has an invalid data format");
+ Slog.e(TAG, "Property value" + propValue + "has an invalid data format");
return false;
}
if (mPropToValidValue.containsKey(propValue.prop)) {
@@ -795,7 +795,7 @@
+ rawValue.int64Values.size() + rawValue.bytes.size()
+ rawValue.stringValue.length();
if (sizeOfAllValue == 0) {
- Log.e(TAG, "Property value is empty: " + propValue);
+ Slog.e(TAG, "Property value is empty: " + propValue);
return false;
}
switch (propId & VehiclePropertyType.MASK) {
@@ -841,7 +841,7 @@
try {
integerList.add(f.getInt(clazz));
} catch (IllegalAccessException | RuntimeException e) {
- Log.w(TAG, "Failed to get value");
+ Slog.w(TAG, "Failed to get value");
}
}
}
diff --git a/service/src/com/android/car/hal/UserHalService.java b/service/src/com/android/car/hal/UserHalService.java
index d669a73..e26a486 100644
--- a/service/src/com/android/car/hal/UserHalService.java
+++ b/service/src/com/android/car/hal/UserHalService.java
@@ -56,7 +56,7 @@
import android.sysprop.CarProperties;
import android.text.TextUtils;
import android.util.EventLog;
-import android.util.Log;
+import android.util.Slog;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
@@ -143,7 +143,7 @@
@Override
public void init() {
- if (DBG) Log.d(TAG, "init()");
+ if (DBG) Slog.d(TAG, "init()");
if (mProperties == null) {
return;
@@ -153,7 +153,7 @@
for (int i = 0; i < size; i++) {
VehiclePropConfig config = mProperties.valueAt(i);
if (VehicleHal.isPropertySubscribable(config)) {
- if (DBG) Log.d(TAG, "subscribing to property " + config.prop);
+ if (DBG) Slog.d(TAG, "subscribing to property " + config.prop);
mHal.subscribeProperty(this, config.prop);
}
}
@@ -161,12 +161,12 @@
@Override
public void release() {
- if (DBG) Log.d(TAG, "release()");
+ if (DBG) Slog.d(TAG, "release()");
}
@Override
public void onHalEvents(List<VehiclePropValue> values) {
- if (DBG) Log.d(TAG, "handleHalEvents(): " + values);
+ if (DBG) Slog.d(TAG, "handleHalEvents(): " + values);
for (int i = 0; i < values.size(); i++) {
VehiclePropValue value = values.get(i);
@@ -184,14 +184,14 @@
UserHalService::handleOnCreateUserResponse, this, value));
break;
case REMOVE_USER:
- Log.w(TAG, "Received REMOVE_USER HAL event: " + value);
+ Slog.w(TAG, "Received REMOVE_USER HAL event: " + value);
break;
case USER_IDENTIFICATION_ASSOCIATION:
mHandler.sendMessage(obtainMessage(
UserHalService::handleOnUserIdentificationAssociation, this, value));
break;
default:
- Log.w(TAG, "received unsupported event from HAL: " + value);
+ Slog.w(TAG, "received unsupported event from HAL: " + value);
}
}
}
@@ -199,7 +199,7 @@
@Override
public void onPropertySetError(int property, int area,
@CarPropertyManager.CarSetPropertyErrorCode int errorCode) {
- if (DBG) Log.d(TAG, "handlePropertySetError(" + property + "/" + area + ")");
+ if (DBG) Slog.d(TAG, "handlePropertySetError(" + property + "/" + area + ")");
}
@Override
@@ -210,7 +210,7 @@
@Override
public void takeProperties(Collection<VehiclePropConfig> properties) {
if (properties.isEmpty()) {
- Log.w(TAG, UNSUPPORTED_MSG);
+ Slog.w(TAG, UNSUPPORTED_MSG);
return;
}
SparseArray<VehiclePropConfig> supportedProperties = new SparseArray<>(5);
@@ -274,7 +274,7 @@
*/
public void getInitialUserInfo(int requestType, int timeoutMs, @NonNull UsersInfo usersInfo,
@NonNull HalCallback<InitialUserInfoResponse> callback) {
- if (DBG) Log.d(TAG, "getInitialInfo(" + requestType + ")");
+ if (DBG) Slog.d(TAG, "getInitialInfo(" + requestType + ")");
Preconditions.checkArgumentPositive(timeoutMs, "timeout must be positive");
Objects.requireNonNull(usersInfo);
UserHalHelper.checkValid(usersInfo);
@@ -327,11 +327,11 @@
UserHalService::handleCheckIfRequestTimedOut, this, requestId).setWhat(requestId),
timeoutMs);
try {
- if (DBG) Log.d(TAG, "Calling hal.set(): " + request);
+ if (DBG) Slog.d(TAG, "Calling hal.set(): " + request);
mHal.set(request);
} catch (ServiceSpecificException e) {
handleRemovePendingRequest(requestId);
- Log.w(TAG, "Failed to set " + request, e);
+ Slog.w(TAG, "Failed to set " + request, e);
callback.onResponse(HalCallback.STATUS_HAL_SET_TIMEOUT, null);
}
}
@@ -351,7 +351,7 @@
Preconditions.checkArgumentPositive(timeoutMs, "timeout must be positive");
Objects.requireNonNull(callback, "callback cannot be null");
Objects.requireNonNull(request, "request cannot be null");
- if (DBG) Log.d(TAG, "switchUser(" + request + ")");
+ if (DBG) Slog.d(TAG, "switchUser(" + request + ")");
checkSupported();
request.requestId = getNextRequestId();
@@ -382,7 +382,7 @@
*/
public void removeUser(@NonNull RemoveUserRequest request) {
Objects.requireNonNull(request, "request cannot be null");
- if (DBG) Log.d(TAG, "removeUser(" + request + ")");
+ if (DBG) Slog.d(TAG, "removeUser(" + request + ")");
checkSupported();
request.requestId = getNextRequestId();
@@ -397,10 +397,10 @@
request.removedUserInfo.userId, request.removedUserInfo.flags, /* timeout */ -1);
try {
- if (DBG) Log.d(TAG, "Calling hal.set(): " + propRequest);
+ if (DBG) Slog.d(TAG, "Calling hal.set(): " + propRequest);
mHal.set(propRequest);
} catch (ServiceSpecificException e) {
- Log.w(TAG, "Failed to set REMOVE USER", e);
+ Slog.w(TAG, "Failed to set REMOVE USER", e);
}
}
@@ -419,7 +419,7 @@
Objects.requireNonNull(request);
Preconditions.checkArgumentPositive(timeoutMs, "timeout must be positive");
Objects.requireNonNull(callback);
- if (DBG) Log.d(TAG, "createUser(): req=" + request + ", timeout=" + timeoutMs);
+ if (DBG) Slog.d(TAG, "createUser(): req=" + request + ", timeout=" + timeoutMs);
checkSupported();
request.requestId = getNextRequestId();
@@ -446,7 +446,7 @@
*/
public void postSwitchResponse(@NonNull SwitchUserRequest request) {
Objects.requireNonNull(request, "request cannot be null");
- if (DBG) Log.d(TAG, "postSwitchResponse(" + request + ")");
+ if (DBG) Slog.d(TAG, "postSwitchResponse(" + request + ")");
checkSupported();
request.messageType = SwitchUserMessageType.ANDROID_POST_SWITCH;
@@ -460,10 +460,10 @@
: CarStatsLog.CAR_USER_HAL_POST_SWITCH_RESPONSE_REPORTED__SWITCH_STATUS__FAILURE);
try {
- if (DBG) Log.d(TAG, "Calling hal.set(): " + propRequest);
+ if (DBG) Slog.d(TAG, "Calling hal.set(): " + propRequest);
mHal.set(propRequest);
} catch (ServiceSpecificException e) {
- Log.w(TAG, "Failed to set ANDROID POST SWITCH", e);
+ Slog.w(TAG, "Failed to set ANDROID POST SWITCH", e);
}
}
@@ -474,7 +474,7 @@
*/
public void legacyUserSwitch(@NonNull SwitchUserRequest request) {
Objects.requireNonNull(request, "request cannot be null");
- if (DBG) Log.d(TAG, "userSwitchLegacy(" + request + ")");
+ if (DBG) Slog.d(TAG, "userSwitchLegacy(" + request + ")");
checkSupported();
request.requestId = getNextRequestId();
@@ -492,10 +492,10 @@
//CHECKSTYLE:ON IndentationCheck
try {
- if (DBG) Log.d(TAG, "Calling hal.set(): " + propRequest);
+ if (DBG) Slog.d(TAG, "Calling hal.set(): " + propRequest);
mHal.set(propRequest);
} catch (ServiceSpecificException e) {
- Log.w(TAG, "Failed to set LEGACY ANDROID SWITCH", e);
+ Slog.w(TAG, "Failed to set LEGACY ANDROID SWITCH", e);
}
}
@@ -525,7 +525,7 @@
request.requestId = getNextRequestId();
- if (DBG) Log.d(TAG, "getUserAssociation(): req=" + request);
+ if (DBG) Slog.d(TAG, "getUserAssociation(): req=" + request);
VehiclePropValue requestAsPropValue = UserHalHelper.toVehiclePropValue(request);
@@ -534,30 +534,30 @@
VehiclePropValue responseAsPropValue = mHal.get(requestAsPropValue);
if (responseAsPropValue == null) {
- Log.w(TAG, "HAL returned null for request " + requestAsPropValue);
+ Slog.w(TAG, "HAL returned null for request " + requestAsPropValue);
return null;
}
logEventWithErrorMessage(EventLogTags.CAR_USER_HAL_GET_USER_AUTH_RESP, responseAsPropValue);
- if (DBG) Log.d(TAG, "getUserAssociation(): responseAsPropValue=" + responseAsPropValue);
+ if (DBG) Slog.d(TAG, "getUserAssociation(): responseAsPropValue=" + responseAsPropValue);
UserIdentificationResponse response;
try {
response = UserHalHelper.toUserIdentificationResponse(responseAsPropValue);
} catch (IllegalArgumentException e) {
- Log.w(TAG, "invalid response from HAL for " + requestAsPropValue, e);
+ Slog.w(TAG, "invalid response from HAL for " + requestAsPropValue, e);
return null;
}
- if (DBG) Log.d(TAG, "getUserAssociation(): response=" + response);
+ if (DBG) Slog.d(TAG, "getUserAssociation(): response=" + response);
// Validate the response according to the request
if (response.requestId != request.requestId) {
- Log.w(TAG, "invalid request id (should be " + request.requestId + ") on HAL response: "
+ Slog.w(TAG, "invalid request id (should be " + request.requestId + ") on HAL response: "
+ response);
return null;
}
if (response.numberAssociation != request.numberAssociationTypes) {
- Log.w(TAG, "Wrong number of association types on HAL response (expected "
+ Slog.w(TAG, "Wrong number of association types on HAL response (expected "
+ request.numberAssociationTypes + ") for request " + requestAsPropValue
+ ": " + response);
return null;
@@ -566,7 +566,7 @@
int expectedType = request.associationTypes.get(i);
int actualType = response.associations.get(i).type;
if (actualType != expectedType) {
- Log.w(TAG, "Wrong type on index " + i + " of HAL response (" + response + ") for "
+ Slog.w(TAG, "Wrong type on index " + i + " of HAL response (" + response + ") for "
+ "request " + requestAsPropValue + " : expected "
+ UserIdentificationAssociationType.toString(expectedType)
+ ", got " + UserIdentificationAssociationType.toString(actualType));
@@ -605,7 +605,7 @@
Preconditions.checkArgumentPositive(timeoutMs, "timeout must be positive");
Objects.requireNonNull(request, "request cannot be null");
Objects.requireNonNull(callback, "callback cannot be null");
- if (DBG) Log.d(TAG, "setUserAssociation(" + request + ")");
+ if (DBG) Slog.d(TAG, "setUserAssociation(" + request + ")");
// Check that it doesn't have dupes
SparseBooleanArray types = new SparseBooleanArray(request.numberAssociations);
@@ -646,13 +646,13 @@
private void handleOnUserIdentificationAssociation(@NonNull VehiclePropValue value) {
logEventWithErrorMessage(EventLogTags.CAR_USER_HAL_SET_USER_AUTH_RESP, value);
- if (DBG) Log.d(TAG, "handleOnUserIdentificationAssociation(): " + value);
+ if (DBG) Slog.d(TAG, "handleOnUserIdentificationAssociation(): " + value);
int requestId = value.value.int32Values.get(0);
HalCallback<UserIdentificationResponse> callback = handleGetPendingCallback(requestId,
UserIdentificationResponse.class);
if (callback == null) {
- Log.w(TAG, "no callback for requestId " + requestId + ": " + value);
+ Slog.w(TAG, "no callback for requestId " + requestId + ": " + value);
return;
}
PendingRequest<?, ?> pendingRequest = handleRemovePendingRequest(requestId);
@@ -660,7 +660,7 @@
try {
response = UserHalHelper.toUserIdentificationResponse(value);
} catch (RuntimeException e) {
- Log.w(TAG, "error parsing UserIdentificationResponse (" + value + ")", e);
+ Slog.w(TAG, "error parsing UserIdentificationResponse (" + value + ")", e);
callback.onResponse(HalCallback.STATUS_WRONG_HAL_RESPONSE, null);
CarStatsLog.write(CarStatsLog.CAR_USER_HAL_SET_USER_ASSOCIATION_RESPONSE_REPORTED,
getHalCallbackStatusForStatsd(HalCallback.STATUS_WRONG_HAL_RESPONSE), requestId,
@@ -682,7 +682,7 @@
}
if (response.numberAssociation != request.numberAssociations) {
- Log.w(TAG, "Wrong number of association types on HAL response (expected "
+ Slog.w(TAG, "Wrong number of association types on HAL response (expected "
+ request.numberAssociations + ") for request " + request
+ ": " + response);
callback.onResponse(HalCallback.STATUS_WRONG_HAL_RESPONSE, null);
@@ -695,7 +695,7 @@
int expectedType = request.associations.get(i).type;
int actualType = response.associations.get(i).type;
if (actualType != expectedType) {
- Log.w(TAG, "Wrong type on index " + i + " of HAL response (" + response + ") for "
+ Slog.w(TAG, "Wrong type on index " + i + " of HAL response (" + response + ") for "
+ "request " + value + " : expected "
+ UserIdentificationAssociationType.toString(expectedType)
+ ", got " + UserIdentificationAssociationType.toString(actualType));
@@ -706,7 +706,7 @@
}
}
- if (DBG) Log.d(TAG, "replying to request " + requestId + " with " + response);
+ if (DBG) Slog.d(TAG, "replying to request " + requestId + " with " + response);
callback.onResponse(HalCallback.STATUS_OK, response);
logSetUserAssociationResponse(requestId, response, HalCallback.STATUS_OK);
}
@@ -754,7 +754,7 @@
PendingRequest<?, RESP> pendingRequest = new PendingRequest<>(responseClass, request,
callback);
if (DBG) {
- Log.d(TAG, "adding pending request (" + pendingRequest + ") for requestId "
+ Slog.d(TAG, "adding pending request (" + pendingRequest + ") for requestId "
+ requestId);
}
mPendingRequests.put(requestId, pendingRequest);
@@ -777,7 +777,7 @@
for (int i = 0; i < mPendingRequests.size(); i++) {
PendingRequest<?, ?> pendingRequest = mPendingRequests.valueAt(i);
if (pendingRequest.responseClass == responseClass) {
- Log.w(TAG, "Already have pending request of type " + responseClass);
+ Slog.w(TAG, "Already have pending request of type " + responseClass);
callback.onResponse(HalCallback.STATUS_CONCURRENT_OPERATION, null);
return true;
}
@@ -790,7 +790,7 @@
*/
@Nullable
private PendingRequest<?, ?> handleRemovePendingRequest(int requestId) {
- if (DBG) Log.d(TAG, "Removing pending request #" + requestId);
+ if (DBG) Slog.d(TAG, "Removing pending request #" + requestId);
mHandler.removeMessages(requestId);
PendingRequest<?, ?> pendingRequest;
synchronized (mLock) {
@@ -804,7 +804,7 @@
PendingRequest<?, ?> pendingRequest = getPendingRequest(requestId);
if (pendingRequest == null) return;
- Log.w(TAG, "Request #" + requestId + " timed out");
+ Slog.w(TAG, "Request #" + requestId + " timed out");
handleRemovePendingRequest(requestId);
pendingRequest.callback.onResponse(HalCallback.STATUS_HAL_RESPONSE_TIMEOUT, null);
}
@@ -829,7 +829,7 @@
InitialUserInfoResponseAction.DEFAULT), /* user id= */ -1,
/* flag= */ -1, /* user locales= */ "");
- Log.w(TAG, "no callback for requestId " + requestId + ": " + value);
+ Slog.w(TAG, "no callback for requestId " + requestId + ": " + value);
return;
}
handleRemovePendingRequest(requestId);
@@ -838,7 +838,7 @@
try {
response = UserHalHelper.toInitialUserInfoResponse(value);
} catch (RuntimeException e) {
- Log.e(TAG, "invalid response (" + value + ") from HAL", e);
+ Slog.e(TAG, "invalid response (" + value + ") from HAL", e);
EventLog.writeEvent(EventLogTags.CAR_USER_HAL_INITIAL_USER_INFO_RESP, requestId,
HalCallback.STATUS_WRONG_HAL_RESPONSE);
CarStatsLog.write(CarStatsLog.CAR_USER_HAL_INITIAL_USER_INFO_RESPONSE_REPORTED,
@@ -861,7 +861,7 @@
response.userToSwitchOrCreate.userId, response.userToSwitchOrCreate.flags,
response.userLocales);
- if (DBG) Log.d(TAG, "replying to request " + requestId + " with " + response);
+ if (DBG) Slog.d(TAG, "replying to request " + requestId + " with " + response);
callback.onResponse(HalCallback.STATUS_OK, response);
}
@@ -893,7 +893,7 @@
return;
}
- Log.e(TAG, "handleOnSwitchUserResponse invalid message type (" + messageType
+ Slog.e(TAG, "handleOnSwitchUserResponse invalid message type (" + messageType
+ ") from HAL: " + value);
// check if a callback exists for the request ID
@@ -921,7 +921,7 @@
// HAL vehicle request should have negative request ID
if (requestId >= 0) {
- Log.e(TAG, "handleVehicleRequest invalid requestId (" + requestId + ") from HAL: "
+ Slog.e(TAG, "handleVehicleRequest invalid requestId (" + requestId + ") from HAL: "
+ value);
return;
}
@@ -937,7 +937,7 @@
if (callback == null) {
EventLog.writeEvent(EventLogTags.CAR_USER_HAL_SWITCH_USER_RESP, requestId,
HalCallback.STATUS_INVALID);
- Log.w(TAG, "no callback for requestId " + requestId + ": " + value);
+ Slog.w(TAG, "no callback for requestId " + requestId + ": " + value);
logHalSwitchUserResponse(requestId, HalCallback.STATUS_WRONG_HAL_RESPONSE);
return;
}
@@ -950,7 +950,7 @@
if (response.status == SwitchUserStatus.SUCCESS
|| response.status == SwitchUserStatus.FAILURE) {
if (DBG) {
- Log.d(TAG, "replying to request " + requestId + " with " + response);
+ Slog.d(TAG, "replying to request " + requestId + " with " + response);
}
EventLog.writeEvent(EventLogTags.CAR_USER_HAL_SWITCH_USER_RESP, requestId,
HalCallback.STATUS_OK, response.status, response.errorMessage);
@@ -959,7 +959,7 @@
} else {
EventLog.writeEvent(EventLogTags.CAR_USER_HAL_SWITCH_USER_RESP, requestId,
HalCallback.STATUS_WRONG_HAL_RESPONSE, response.status, response.errorMessage);
- Log.e(TAG, "invalid status (" + response.status + ") from HAL: " + value);
+ Slog.e(TAG, "invalid status (" + response.status + ") from HAL: " + value);
callback.onResponse(HalCallback.STATUS_WRONG_HAL_RESPONSE, null);
logHalSwitchUserResponse(requestId, HalCallback.STATUS_WRONG_HAL_RESPONSE,
response.status);
@@ -973,7 +973,7 @@
if (callback == null) {
EventLog.writeEvent(EventLogTags.CAR_USER_HAL_CREATE_USER_RESP, requestId,
HalCallback.STATUS_INVALID);
- Log.w(TAG, "no callback for requestId " + requestId + ": " + value);
+ Slog.w(TAG, "no callback for requestId " + requestId + ": " + value);
return;
}
handleRemovePendingRequest(requestId);
@@ -984,7 +984,7 @@
if (response.status == CreateUserStatus.SUCCESS
|| response.status == CreateUserStatus.FAILURE) {
if (DBG) {
- Log.d(TAG, "replying to request " + requestId + " with " + response);
+ Slog.d(TAG, "replying to request " + requestId + " with " + response);
}
EventLog.writeEvent(EventLogTags.CAR_USER_HAL_CREATE_USER_RESP, requestId,
HalCallback.STATUS_OK, response.status, response.errorMessage);
@@ -993,7 +993,7 @@
} else {
EventLog.writeEvent(EventLogTags.CAR_USER_HAL_CREATE_USER_RESP, requestId,
HalCallback.STATUS_WRONG_HAL_RESPONSE, response.status, response.errorMessage);
- Log.e(TAG, "invalid status (" + response.status + ") from HAL: " + value);
+ Slog.e(TAG, "invalid status (" + response.status + ") from HAL: " + value);
callback.onResponse(HalCallback.STATUS_WRONG_HAL_RESPONSE, null);
logHalCreateUserResponse(requestId, HalCallback.STATUS_WRONG_HAL_RESPONSE);
}
@@ -1062,7 +1062,7 @@
if (pendingRequest == null) return null;
if (pendingRequest.responseClass != clazz) {
- Log.e(TAG, "Invalid callback class for request " + requestId + ": expected" + clazz
+ Slog.e(TAG, "Invalid callback class for request " + requestId + ": expected" + clazz
+ ", but got is " + pendingRequest.responseClass);
// TODO(b/150413515): add unit test for this scenario once it supports other properties
return null;
@@ -1136,13 +1136,13 @@
private static <T> T getRequest(@Nullable PendingRequest<?, ?> pendingRequest,
@NonNull Class<T> clazz, int requestId) {
if (pendingRequest == null) {
- Log.e(TAG, "No pending request for id " + requestId);
+ Slog.e(TAG, "No pending request for id " + requestId);
return null;
}
Object request = pendingRequest.request;
if (!clazz.isInstance(request)) {
- Log.e(TAG, "Wrong pending request for id " + requestId + ": " + pendingRequest);
+ Slog.e(TAG, "Wrong pending request for id " + requestId + ": " + pendingRequest);
return null;
}
return clazz.cast(request);
diff --git a/service/src/com/android/car/hal/VehicleHal.java b/service/src/com/android/car/hal/VehicleHal.java
index 9fd69dd..146e99a 100644
--- a/service/src/com/android/car/hal/VehicleHal.java
+++ b/service/src/com/android/car/hal/VehicleHal.java
@@ -42,7 +42,7 @@
import android.os.ServiceSpecificException;
import android.os.SystemClock;
import android.util.ArraySet;
-import android.util.Log;
+import android.util.Slog;
import android.util.SparseArray;
import com.android.car.CarLog;
@@ -178,7 +178,7 @@
private void fetchAllPropConfigs() {
synchronized (mLock) {
if (!mAllProperties.isEmpty()) { // already set
- Log.i(CarLog.TAG_HAL, "fetchAllPropConfigs already fetched");
+ Slog.i(CarLog.TAG_HAL, "fetchAllPropConfigs already fetched");
return;
}
}
@@ -186,7 +186,7 @@
try {
configs = mHalClient.getAllPropConfigs();
if (configs == null || configs.size() == 0) {
- Log.e(CarLog.TAG_HAL, "getAllPropConfigs returned empty configs");
+ Slog.e(CarLog.TAG_HAL, "getAllPropConfigs returned empty configs");
return;
}
} catch (RemoteException e) {
@@ -197,7 +197,7 @@
// Create map of all properties
for (VehiclePropConfig p : configs) {
if (DBG) {
- Log.i(CarLog.TAG_HAL, "Add config for prop:" + Integer.toHexString(p.prop)
+ Slog.i(CarLog.TAG_HAL, "Add config for prop:" + Integer.toHexString(p.prop)
+ " config:" + p);
}
mAllProperties.put(p.prop, p);
@@ -259,7 +259,7 @@
mHalClient.unsubscribe(p);
} catch (RemoteException e) {
// Ignore exceptions on shutdown path.
- Log.w(CarLog.TAG_HAL, "Failed to unsubscribe", e);
+ Slog.w(CarLog.TAG_HAL, "Failed to unsubscribe", e);
}
}
mSubscribedProperties.clear();
@@ -332,7 +332,7 @@
public void subscribeProperty(HalServiceBase service, int property,
float samplingRateHz, int flags) throws IllegalArgumentException {
if (DBG) {
- Log.i(CarLog.TAG_HAL, "subscribeProperty, service:" + service
+ Slog.i(CarLog.TAG_HAL, "subscribeProperty, service:" + service
+ ", property: 0x" + toHexString(property));
}
VehiclePropConfig config;
@@ -355,10 +355,10 @@
try {
mHalClient.subscribe(opts);
} catch (RemoteException e) {
- Log.e(CarLog.TAG_HAL, "Failed to subscribe to property: 0x" + property, e);
+ Slog.e(CarLog.TAG_HAL, "Failed to subscribe to property: 0x" + property, e);
}
} else {
- Log.e(CarLog.TAG_HAL, "Cannot subscribe to property: " + property);
+ Slog.e(CarLog.TAG_HAL, "Cannot subscribe to property: " + property);
}
}
@@ -368,7 +368,7 @@
*/
public void unsubscribeProperty(HalServiceBase service, int property) {
if (DBG) {
- Log.i(CarLog.TAG_HAL, "unsubscribeProperty, service:" + service
+ Slog.i(CarLog.TAG_HAL, "unsubscribeProperty, service:" + service
+ ", property: 0x" + toHexString(property));
}
VehiclePropConfig config;
@@ -377,7 +377,7 @@
}
if (config == null) {
- Log.e(CarLog.TAG_HAL, "unsubscribeProperty: property " + property + " does not exist");
+ Slog.e(CarLog.TAG_HAL, "unsubscribeProperty: property " + property + " does not exist");
} else if (isPropertySubscribable(config)) {
synchronized (mLock) {
assertServiceOwnerLocked(service, property);
@@ -386,11 +386,11 @@
try {
mHalClient.unsubscribe(property);
} catch (RemoteException e) {
- Log.e(CarLog.TAG_SERVICE, "Failed to unsubscribe from property: 0x"
+ Slog.e(CarLog.TAG_SERVICE, "Failed to unsubscribe from property: 0x"
+ toHexString(property), e);
}
} else {
- Log.e(CarLog.TAG_HAL, "Cannot unsubscribe property: " + property);
+ Slog.e(CarLog.TAG_HAL, "Cannot unsubscribe property: " + property);
}
}
@@ -419,7 +419,7 @@
try {
return get(propertyId);
} catch (ServiceSpecificException e) {
- Log.e(CarLog.TAG_HAL, "Cannot get property:" + propertyId, e);
+ Slog.e(CarLog.TAG_HAL, "Cannot get property:" + propertyId, e);
}
}
throw new IllegalStateException("Cannot get property:" + propertyId
@@ -454,7 +454,7 @@
*/
public VehiclePropValue get(int propertyId, int areaId) {
if (DBG) {
- Log.i(CarLog.TAG_HAL, "get, property: 0x" + toHexString(propertyId)
+ Slog.i(CarLog.TAG_HAL, "get, property: 0x" + toHexString(propertyId)
+ ", areaId: 0x" + toHexString(areaId));
}
return mHalClient.getValue(createPropValue(propertyId, areaId));
@@ -562,7 +562,7 @@
for (VehiclePropValue v : propValues) {
HalServiceBase service = mPropertyHandlers.get(v.prop);
if (service == null) {
- Log.e(CarLog.TAG_HAL, "HalService not found for prop: 0x"
+ Slog.e(CarLog.TAG_HAL, "HalService not found for prop: 0x"
+ toHexString(v.prop));
continue;
}
@@ -592,7 +592,7 @@
@Override
public void onPropertySetError(@CarPropertyManager.CarSetPropertyErrorCode int errorCode,
int propId, int areaId) {
- Log.e(CarLog.TAG_HAL, String.format("onPropertySetError, errorCode: %d, prop: 0x%x, "
+ Slog.e(CarLog.TAG_HAL, String.format("onPropertySetError, errorCode: %d, prop: 0x%x, "
+ "area: 0x%x", errorCode, propId, areaId));
if (propId != VehicleProperty.INVALID) {
HalServiceBase service = mPropertyHandlers.get(propId);
@@ -796,7 +796,7 @@
}
break;
default:
- Log.e(CarLog.TAG_HAL, "Property type unsupported:" + propertyType);
+ Slog.e(CarLog.TAG_HAL, "Property type unsupported:" + propertyType);
return;
}
v.timestamp = SystemClock.elapsedRealtimeNanos() + TimeUnit.SECONDS.toNanos(duration);
@@ -871,7 +871,7 @@
HalClient client = mClient.get();
if (client != null) {
if (DBG) {
- Log.i(CarLog.TAG_HAL, "set, property: 0x" + toHexString(mPropValue.prop)
+ Slog.i(CarLog.TAG_HAL, "set, property: 0x" + toHexString(mPropValue.prop)
+ ", areaId: 0x" + toHexString(mPropValue.areaId));
}
client.setValue(mPropValue);
diff --git a/service/src/com/android/car/hal/VmsHalService.java b/service/src/com/android/car/hal/VmsHalService.java
index 2704c55..cc0ab7b 100644
--- a/service/src/com/android/car/hal/VmsHalService.java
+++ b/service/src/com/android/car/hal/VmsHalService.java
@@ -45,7 +45,7 @@
import android.os.RemoteException;
import android.os.SystemClock;
import android.util.ArraySet;
-import android.util.Log;
+import android.util.Slog;
import com.android.car.CarLocalServices;
import com.android.car.CarServiceUtils;
@@ -102,26 +102,26 @@
private final VmsClientCallback mClientCallback = new VmsClientCallback() {
@Override
public void onClientConnected(VmsClient client) {
- Log.wtf(TAG, "onClientConnnected triggered for local client");
+ Slog.wtf(TAG, "onClientConnnected triggered for local client");
}
@Override
public void onSubscriptionStateChanged(VmsSubscriptionState subscriptionState) {
- if (DBG) Log.d(TAG, "Handling a subscription state change");
+ if (DBG) Slog.d(TAG, "Handling a subscription state change");
setPropertyValue(createSubscriptionStateMessage(VmsMessageType.SUBSCRIPTIONS_CHANGE,
subscriptionState));
}
@Override
public void onLayerAvailabilityChanged(VmsAvailableLayers availableLayers) {
- if (DBG) Log.d(TAG, "Handling a layer availability change");
+ if (DBG) Slog.d(TAG, "Handling a layer availability change");
setPropertyValue(createAvailableLayersMessage(VmsMessageType.AVAILABILITY_CHANGE,
availableLayers));
}
@Override
public void onPacketReceived(int providerId, VmsLayer layer, byte[] packet) {
- if (DBG) Log.d(TAG, "Handling a data message for Layer: " + layer);
+ if (DBG) Slog.d(TAG, "Handling a data message for Layer: " + layer);
setPropertyValue(createDataMessage(layer, providerId, packet));
}
};
@@ -149,16 +149,16 @@
int propId = context.getResources().getInteger(
com.android.car.R.integer.vmsHalClientMetricsProperty);
if (propId == 0) {
- Log.i(TAG, "Metrics collection disabled");
+ Slog.i(TAG, "Metrics collection disabled");
return 0;
}
if ((propId & VehiclePropertyGroup.MASK) != VehiclePropertyGroup.VENDOR) {
- Log.w(TAG, String.format("Metrics collection disabled, non-vendor property: 0x%x",
+ Slog.w(TAG, String.format("Metrics collection disabled, non-vendor property: 0x%x",
propId));
return 0;
}
- Log.i(TAG, String.format("Metrics collection property: 0x%x", propId));
+ Slog.i(TAG, String.format("Metrics collection property: 0x%x", propId));
return propId;
}
@@ -189,13 +189,13 @@
public void init() {
synchronized (mLock) {
if (!mIsSupported) {
- Log.i(TAG, "VmsHalService VHAL property not supported");
+ Slog.i(TAG, "VmsHalService VHAL property not supported");
return; // Do not continue initialization
}
connectVmsClient();
}
- Log.i(TAG, "Initializing VmsHalService VHAL property");
+ Slog.i(TAG, "Initializing VmsHalService VHAL property");
mVehicleHal.subscribeProperty(this, HAL_PROPERTY_ID);
mHandler.post(() ->
@@ -211,7 +211,7 @@
}
}
if (DBG) {
- Log.d(TAG, "Releasing VmsHalService VHAL property");
+ Slog.d(TAG, "Releasing VmsHalService VHAL property");
}
mVehicleHal.unsubscribeProperty(this, HAL_PROPERTY_ID);
}
@@ -239,7 +239,7 @@
*/
public void dumpMetrics(FileDescriptor fd) {
if (mClientMetricsProperty == 0) {
- Log.w(TAG, "Metrics collection is disabled");
+ Slog.w(TAG, "Metrics collection is disabled");
return;
}
@@ -248,10 +248,10 @@
vehicleProp = mVehicleHal.get(mClientMetricsProperty);
} catch (RuntimeException e) {
// Failures to retrieve metrics should be non-fatal
- Log.e(TAG, "While reading metrics from client", e);
+ Slog.e(TAG, "While reading metrics from client", e);
}
if (vehicleProp == null) {
- if (DBG) Log.d(TAG, "Metrics unavailable");
+ if (DBG) Slog.d(TAG, "Metrics unavailable");
return;
}
@@ -259,7 +259,7 @@
fout.write(toByteArray(vehicleProp.value.bytes));
fout.flush();
} catch (IOException e) {
- Log.e(TAG, "Error writing metrics to output stream", e);
+ Slog.e(TAG, "Error writing metrics to output stream", e);
}
}
@@ -271,12 +271,12 @@
*/
@Override
public void onHalEvents(List<VehiclePropValue> values) {
- if (DBG) Log.d(TAG, "Handling a VMS property change");
+ if (DBG) Slog.d(TAG, "Handling a VMS property change");
for (VehiclePropValue v : values) {
ArrayList<Integer> vec = v.value.int32Values;
int messageType = vec.get(VmsBaseMessageIntegerValuesIndex.MESSAGE_TYPE);
- if (DBG) Log.d(TAG, "Received " + VmsMessageType.toString(messageType) + " message");
+ if (DBG) Slog.d(TAG, "Received " + VmsMessageType.toString(messageType) + " message");
try {
switch (messageType) {
case VmsMessageType.DATA:
@@ -313,10 +313,10 @@
handleStartSessionEvent(vec);
break;
default:
- Log.e(TAG, "Unexpected message type: " + messageType);
+ Slog.e(TAG, "Unexpected message type: " + messageType);
}
} catch (IndexOutOfBoundsException e) {
- Log.e(TAG, "While handling " + VmsMessageType.toString(messageType), e);
+ Slog.e(TAG, "While handling " + VmsMessageType.toString(messageType), e);
}
}
}
@@ -333,7 +333,7 @@
try {
mClient.unregister();
} catch (RemoteException e) {
- Log.wtf(TAG, "Local broker should not throw RemoteException", e);
+ Slog.wtf(TAG, "Local broker should not throw RemoteException", e);
}
mClient = null;
}
@@ -343,7 +343,7 @@
private static VmsClient initVmsClient(Handler handler, VmsClientCallback callback) {
VmsBrokerService brokerService = CarLocalServices.getService(VmsBrokerService.class);
if (brokerService == null) {
- Log.e(TAG, "Broker service is not enabled");
+ Slog.e(TAG, "Broker service is not enabled");
return null;
}
VmsClient client = new VmsClient(brokerService, new HandlerExecutor(handler), callback,
@@ -352,7 +352,7 @@
try {
client.register();
} catch (RemoteException e) {
- Log.wtf(TAG, "Local broker should not throw RemoteException", e);
+ Slog.wtf(TAG, "Local broker should not throw RemoteException", e);
}
return client;
}
@@ -377,7 +377,7 @@
private void handleStartSessionEvent(List<Integer> message) {
int coreId = message.get(VmsStartSessionMessageIntegerValuesIndex.SERVICE_ID);
int clientId = message.get(VmsStartSessionMessageIntegerValuesIndex.CLIENT_ID);
- Log.i(TAG, "Starting new session with coreId: " + coreId + " client: " + clientId);
+ Slog.i(TAG, "Starting new session with coreId: " + coreId + " client: " + clientId);
if (coreId != mCoreId) {
// Reset VmsClient
@@ -404,7 +404,7 @@
VmsLayer vmsLayer = parseVmsLayerFromMessage(message);
int publisherId = parsePublisherIdFromMessage(message);
if (DBG) {
- Log.d(TAG,
+ Slog.d(TAG,
"Handling a data event for Layer: " + vmsLayer + " Publisher: " + publisherId);
}
getVmsClient().publishPacket(publisherId, vmsLayer, payload);
@@ -421,7 +421,7 @@
*/
private void handleSubscribeEvent(List<Integer> message) {
VmsLayer vmsLayer = parseVmsLayerFromMessage(message);
- if (DBG) Log.d(TAG, "Handling a subscribe event for Layer: " + vmsLayer);
+ if (DBG) Slog.d(TAG, "Handling a subscribe event for Layer: " + vmsLayer);
mSubscriptionHelper.subscribe(vmsLayer);
}
@@ -439,7 +439,7 @@
VmsLayer vmsLayer = parseVmsLayerFromMessage(message);
int publisherId = parsePublisherIdFromMessage(message);
if (DBG) {
- Log.d(TAG, "Handling a subscribe event for Layer: " + vmsLayer
+ Slog.d(TAG, "Handling a subscribe event for Layer: " + vmsLayer
+ " Publisher: " + publisherId);
}
mSubscriptionHelper.subscribe(vmsLayer, publisherId);
@@ -456,7 +456,7 @@
*/
private void handleUnsubscribeEvent(List<Integer> message) {
VmsLayer vmsLayer = parseVmsLayerFromMessage(message);
- if (DBG) Log.d(TAG, "Handling an unsubscribe event for Layer: " + vmsLayer);
+ if (DBG) Slog.d(TAG, "Handling an unsubscribe event for Layer: " + vmsLayer);
mSubscriptionHelper.unsubscribe(vmsLayer);
}
@@ -474,7 +474,7 @@
VmsLayer vmsLayer = parseVmsLayerFromMessage(message);
int publisherId = parsePublisherIdFromMessage(message);
if (DBG) {
- Log.d(TAG, "Handling an unsubscribe event for Layer: " + vmsLayer
+ Slog.d(TAG, "Handling an unsubscribe event for Layer: " + vmsLayer
+ " Publisher: " + publisherId);
}
mSubscriptionHelper.unsubscribe(vmsLayer, publisherId);
@@ -499,7 +499,7 @@
*/
private void handlePublisherIdRequest(byte[] payload) {
if (DBG) {
- Log.d(TAG, "Handling a publisher id request event");
+ Slog.d(TAG, "Handling a publisher id request event");
}
VehiclePropValue vehicleProp = createVmsMessage(VmsMessageType.PUBLISHER_ID_RESPONSE);
@@ -524,7 +524,7 @@
* </ul>
*/
private void handlePublisherInfoRequest(List<Integer> message) {
- if (DBG) Log.d(TAG, "Handling a publisher info request event");
+ if (DBG) Slog.d(TAG, "Handling a publisher info request event");
int publisherId = message.get(VmsPublisherInformationIntegerValuesIndex.PUBLISHER_ID);
VehiclePropValue vehicleProp =
@@ -565,7 +565,7 @@
message.get(
VmsOfferingMessageIntegerValuesIndex.NUMBER_OF_OFFERS);
if (DBG) {
- Log.d(TAG, "Handling an offering event of " + numLayerDependencies
+ Slog.d(TAG, "Handling an offering event of " + numLayerDependencies
+ " layers for Publisher: " + publisherId);
}
@@ -620,7 +620,7 @@
synchronized (mLock) {
if (!mIsSupported) {
- Log.w(TAG, "HAL unsupported while attempting to send "
+ Slog.w(TAG, "HAL unsupported while attempting to send "
+ VmsMessageType.toString(messageType));
return;
}
@@ -629,7 +629,7 @@
try {
mVehicleHal.set(vehicleProp);
} catch (RuntimeException e) {
- Log.e(TAG, "While sending " + VmsMessageType.toString(messageType), e);
+ Slog.e(TAG, "While sending " + VmsMessageType.toString(messageType), e);
if (mPropagatePropertyException) {
throw new IllegalStateException(e);
}
diff --git a/tests/carservice_test/src/com/android/car/garagemode/ControllerTest.java b/tests/carservice_test/src/com/android/car/garagemode/ControllerTest.java
index d013d28..f77e762 100644
--- a/tests/carservice_test/src/com/android/car/garagemode/ControllerTest.java
+++ b/tests/carservice_test/src/com/android/car/garagemode/ControllerTest.java
@@ -64,7 +64,7 @@
@RunWith(AndroidJUnit4.class)
@SmallTest
public class ControllerTest {
- private static final Logger LOG = new Logger("ControllerTest");
+ private static final Slogger LOG = new Slogger("ControllerTest");
@Rule public final MockitoRule rule = MockitoJUnit.rule();