#include "android/graphics/Region.h"
#include "core_jni_helpers.h"
+#include <android-base/chrono_utils.h>
#include <JNIHelp.h>
#include <ScopedUtfChars.h>
#include <android_runtime/android_view_Surface.h>
sp<IBinder> token(ibinderForJavaObject(env, tokenObj));
if (token == NULL) return;
- ALOGD_IF_SLOW(100, "Excessive delay in setPowerMode()");
+ android::base::Timer t;
SurfaceComposerClient::setDisplayPowerMode(token, mode);
+ if (t.duration() > 100ms) ALOGD("Excessive delay in setPowerMode()");
}
static jboolean nativeClearContentFrameStats(JNIEnv* env, jclass clazz, jlong nativeObject) {
#include <android/hardware/light/2.0/ILight.h>
#include <android/hardware/light/2.0/types.h>
+#include <android-base/chrono_utils.h>
#include <utils/misc.h>
#include <utils/Log.h>
#include <map>
colorARGB, flashMode, onMS, offMS, brightnessMode);
{
- ALOGD_IF_SLOW(50, "Excessive delay setting light");
+ android::base::Timer t;
Return<Status> ret = hal->setLight(type, state);
processReturn(ret, type, state);
+ if (t.duration() > 50ms) ALOGD("Excessive delay setting light");
}
}
#include <limits.h>
+#include <android-base/chrono_utils.h>
#include <android_runtime/AndroidRuntime.h>
#include <android_runtime/Log.h>
#include <utils/Timers.h>
static void nativeSetInteractive(JNIEnv* /* env */, jclass /* clazz */, jboolean enable) {
std::lock_guard<std::mutex> lock(gPowerHalMutex);
if (getPowerHal()) {
- String8 err("Excessive delay in setInteractive(%s) while turning screen %s");
- ALOGD_IF_SLOW(20, String8::format(err, enable ? "true" : "false", enable ? "on" : "off"));
+ android::base::Timer t;
Return<void> ret = gPowerHal->setInteractive(enable);
processReturn(ret, "setInteractive");
+ if (t.duration() > 20ms) {
+ ALOGD("Excessive delay in setInteractive(%s) while turning screen %s",
+ enable ? "true" : "false", enable ? "on" : "off");
+ }
}
}
static void nativeSetAutoSuspend(JNIEnv* /* env */, jclass /* clazz */, jboolean enable) {
if (enable) {
- ALOGD_IF_SLOW(100, "Excessive delay in autosuspend_enable() while turning screen off");
+ android::base::Timer t;
autosuspend_enable();
+ if (t.duration() > 100ms) {
+ ALOGD("Excessive delay in autosuspend_enable() while turning screen off");
+ }
} else {
- ALOGD_IF_SLOW(100, "Excessive delay in autosuspend_disable() while turning screen on");
+ android::base::Timer t;
autosuspend_disable();
+ if (t.duration() > 100ms) {
+ ALOGD("Excessive delay in autosuspend_disable() while turning screen on");
+ }
}
}