LOCAL_JAVA_LIBRARIES := core-oj core-libart core-lambda-stubs conscrypt okhttp core-junit bouncycastle ext
LOCAL_STATIC_JAVA_LIBRARIES := framework-protos
+LOCAL_STATIC_JAVA_LIBRARIES += analytics-utils
+
LOCAL_MODULE := framework
LOCAL_DX_FLAGS := --core-library --multi-dex
+#!/system/bin/sh
# Script to start "input" on the device, which has a very rudimentary
# shell.
#
injectKeyEvent(new KeyEvent(now, now, KeyEvent.ACTION_DOWN, keyCode, 0, 0,
KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, inputSource));
if (longpress) {
- injectKeyEvent(new KeyEvent(now, now, KeyEvent.ACTION_DOWN, keyCode, 1, 0,
- KeyCharacterMap.VIRTUAL_KEYBOARD, 0, KeyEvent.FLAG_LONG_PRESS,
- inputSource));
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ now = SystemClock.uptimeMillis();
}
injectKeyEvent(new KeyEvent(now, now, KeyEvent.ACTION_UP, keyCode, 0, 0,
KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, inputSource));
import com.android.internal.app.WindowDecorActionBar;
import com.android.internal.policy.PhoneWindow;
+import org.android_x86.analytics.AnalyticsHelper;
+
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
boolean mFinished;
boolean mStartedActivity;
private boolean mDestroyed;
+ private boolean mAppsStatistics;
private boolean mDoReportFullyDrawn = true;
/** true if the activity is going through a transient pause */
/*package*/ boolean mTemporaryPause = false;
mVoiceInteractor.attachActivity(this);
}
mCalled = true;
+ mAppsStatistics = SystemProperties.getBoolean("persist.sys.apps_statistics", false);
}
/**
mFragments.doLoaderStart();
+ // region @android-x86-analytics
+ // screen view
+ if (mAppsStatistics) {
+ AnalyticsHelper.hitScreen(this);
+ }
+ // endregion
getApplication().dispatchActivityStarted(this);
}
return Float.parseFloat(mMap.get(key));
} catch (NumberFormatException ex) {
return defaultValue;
+ } catch (NullPointerException ex) {
+ return defaultValue;
}
}
return Integer.parseInt(mMap.get(key));
} catch (NumberFormatException ex) {
return defaultValue;
+ } catch (NullPointerException ex) {
+ return defaultValue;
}
}
public static final int FLAG_DEFAULT_PRIMARY = 1 << 1;
public static final int FLAG_SD = 1 << 2;
public static final int FLAG_USB = 1 << 3;
+ public static final int FLAG_CDROM = 1 << 6;
public final String id;
public final int flags;
} else {
return res.getString(com.android.internal.R.string.storage_usb_drive);
}
+ } else if ((flags & FLAG_CDROM) != 0) {
+ if (isInteresting(label)) {
+ return res.getString(com.android.internal.R.string.storage_cdrom_label, label);
+ } else {
+ return res.getString(com.android.internal.R.string.storage_cdrom);
+ }
} else {
return null;
}
import java.util.logging.LogManager;
import org.apache.harmony.luni.internal.util.TimezoneGetter;
+import org.android_x86.analytics.AnalyticsHelper;
+
/**
* Main entry point for runtime initialization. Not for
* public consumption.
return Log.printlns(Log.LOG_ID_CRASH, Log.ERROR, tag, msg, tr);
}
+ // region @android-x86-analytics
+ // delay 120 seconds if Analytics failed to capture exception
+ private static final long ANDROID_X86_ANALYTICS_FAILED_DELAY = 120 * 1000;
+ private static long mAnalyticsEnableTime = 0;
+ // endregion
+
/**
* Use this to log a message when a thread exits due to an uncaught
* exception. The framework catches these for the main threads, so
message.append("PID: ").append(Process.myPid());
Clog_e(TAG, message.toString(), e);
}
+ // region @android-x86-analytics
+ if (System.currentTimeMillis() > mAnalyticsEnableTime &&
+ SystemProperties.getBoolean("persist.sys.apps_statistics", false)) {
+ try {
+ AnalyticsHelper.captureException(
+ ActivityThread.currentActivityThread().getSystemContext(),
+ e,
+ t.getName(),
+ ActivityThread.currentPackageName());
+ } catch (Throwable ex) {
+ // delay some time to avoid endless loop exception
+ mAnalyticsEnableTime =
+ System.currentTimeMillis() + ANDROID_X86_ANALYTICS_FAILED_DELAY;
+ }
+ }
+ // endregion
// Try to end profiling. If a profiler is running at this point, and we kill the
// process (below), the in-memory buffer will be lost. So try to stop, which will
OsConstants.CAP_SYS_NICE,
OsConstants.CAP_SYS_PTRACE,
OsConstants.CAP_SYS_TIME,
- OsConstants.CAP_SYS_TTY_CONFIG
+ OsConstants.CAP_SYS_TTY_CONFIG,
+ OsConstants.CAP_WAKE_ALARM
);
/* Containers run without this capability, so avoid setting it in that case */
if (!SystemProperties.getBoolean(PROPERTY_RUNNING_IN_CONTAINER, false)) {
compress(&cinfo, (uint8_t*) inYuv, offsets);
jpeg_finish_compress(&cinfo);
+ jpeg_destroy_compress(&cinfo);
return true;
}
planes[1] = cb;
planes[2] = cr;
- int width = cinfo->image_width;
- int height = cinfo->image_height;
+ JDIMENSION width = cinfo->image_width;
+ JDIMENSION height = cinfo->image_height;
uint8_t* yPlanar = yuv + offsets[0];
uint8_t* vuPlanar = yuv + offsets[1]; //width * height;
- uint8_t* uRows = new uint8_t [8 * (width >> 1)];
- uint8_t* vRows = new uint8_t [8 * (width >> 1)];
-
+ uint8_t* uRows = new uint8_t [8 * (((width + 15) & ~15) >> 1)];
+ uint8_t* vRows = new uint8_t [8 * (((width + 15) & ~15) >> 1)];
+ uint8_t* yRows;
+ int lastLines;
+
+ if ((height & 0xf) != 0) {
+ lastLines = height & 0xf;
+ yRows = new uint8_t [16 * ((width + 15) & ~15)];
+ }
// process 16 lines of Y and 8 lines of U/V each time.
while (cinfo->next_scanline < cinfo->image_height) {
// Jpeg library ignores the rows whose indices are greater than height.
for (int i = 0; i < 16; i++) {
- // y row
- y[i] = yPlanar + (cinfo->next_scanline + i) * fStrides[0];
+ // y row. Add padding if height isn't aligned to 16 pixels.
+ if ((height & 0xf) != 0 && (cinfo->next_scanline + i) > height)
+ y[i] = &yRows[(i - lastLines) * ((width + 15) & ~15)];
+ else
+ y[i] = yPlanar + (cinfo->next_scanline + i) * fStrides[0];
// construct u row and v row
if ((i & 1) == 0) {
}
jpeg_write_raw_data(cinfo, planes, 16);
}
+ if ((height & 0xf) != 0)
+ delete [] yRows;
delete [] uRows;
delete [] vRows;
void Yuv420SpToJpegEncoder::deinterleave(uint8_t* vuPlanar, uint8_t* uRows,
uint8_t* vRows, int rowIndex, int width, int height) {
- int numRows = (height - rowIndex) / 2;
- if (numRows > 8) numRows = 8;
- for (int row = 0; row < numRows; ++row) {
+ int lines = 16;
+ //In case there isn't enough lines to process
+ if ((rowIndex + lines) > height)
+ lines = (height - rowIndex);
+
+ for (int row = 0; row < (lines >> 1); ++row) {
int offset = ((rowIndex >> 1) + row) * fStrides[1];
uint8_t* vu = vuPlanar + offset;
for (int i = 0; i < (width >> 1); ++i) {
std::string file_path;
if (!Readlink(fd, &file_path)) {
return NULL;
+ } else if (!strncmp(file_path.c_str(), "/android/", 9)) {
+ file_path = file_path.substr(8);
}
if (!IsWhitelisted(file_path)) {
<string name="storage_sd_card_label" msgid="6347111320774379257">"<xliff:g id="MANUFACTURER">%s</xliff:g> SD 卡"</string>
<string name="storage_usb_drive" msgid="6261899683292244209">"U 盘"</string>
<string name="storage_usb_drive_label" msgid="4501418548927759953">"<xliff:g id="MANUFACTURER">%s</xliff:g> U 盘"</string>
+ <string name="storage_cdrom">"CD/DVD 光盘"</string>
+ <string name="storage_cdrom_label">"<xliff:g id="MANUFACTURER">%s</xliff:g> CD/DVD 光盘"</string>
<string name="storage_usb" msgid="3017954059538517278">"USB存储器"</string>
<string name="extract_edit_menu_button" msgid="8940478730496610137">"修改"</string>
<string name="data_usage_warning_title" msgid="3620440638180218181">"流量消耗提醒"</string>
<string name="storage_sd_card_label" msgid="6347111320774379257">"<xliff:g id="MANUFACTURER">%s</xliff:g> SD 卡"</string>
<string name="storage_usb_drive" msgid="6261899683292244209">"USB 驅動器"</string>
<string name="storage_usb_drive_label" msgid="4501418548927759953">"<xliff:g id="MANUFACTURER">%s</xliff:g> USB 驅動器"</string>
+ <string name="storage_cdrom">"CD/DVD 光碟機"</string>
+ <string name="storage_cdrom_label">"<xliff:g id="MANUFACTURER">%s</xliff:g> CD/DVD 光碟機"</string>
<string name="storage_usb" msgid="3017954059538517278">"USB 儲存裝置"</string>
<string name="extract_edit_menu_button" msgid="8940478730496610137">"編輯"</string>
<string name="data_usage_warning_title" msgid="3620440638180218181">"數據用量警告"</string>
<string name="ext_media_badremoval_notification_message" msgid="380176703346946313">"請先卸載「<xliff:g id="NAME">%s</xliff:g>」,再將其移除,以免資料遺失。"</string>
<string name="ext_media_nomedia_notification_title" msgid="1704840188641749091">"已移除「<xliff:g id="NAME">%s</xliff:g>」"</string>
<string name="ext_media_nomedia_notification_message" msgid="6471542972147056586">"已移除「<xliff:g id="NAME">%s</xliff:g>」;請插入新的媒體"</string>
- <string name="ext_media_unmounting_notification_title" msgid="640674168454809372">"依然退出「<xliff:g id="NAME">%s</xliff:g>」..."</string>
+ <string name="ext_media_unmounting_notification_title" msgid="640674168454809372">"正在退出「<xliff:g id="NAME">%s</xliff:g>」..."</string>
<string name="ext_media_unmounting_notification_message" msgid="4182843895023357756">"請勿移除"</string>
<string name="ext_media_init_action" msgid="7952885510091978278">"設定"</string>
<string name="ext_media_unmount_action" msgid="1121883233103278199">"退出"</string>
<string name="storage_sd_card_label" msgid="6347111320774379257">"<xliff:g id="MANUFACTURER">%s</xliff:g> SD 卡"</string>
<string name="storage_usb_drive" msgid="6261899683292244209">"USB 隨身碟"</string>
<string name="storage_usb_drive_label" msgid="4501418548927759953">"<xliff:g id="MANUFACTURER">%s</xliff:g> USB 隨身碟"</string>
+ <string name="storage_cdrom">"CD/DVD 光碟機"</string>
+ <string name="storage_cdrom_label">"<xliff:g id="MANUFACTURER">%s</xliff:g> CD/DVD 光碟機"</string>
<string name="storage_usb" msgid="3017954059538517278">"USB 儲存裝置"</string>
<string name="extract_edit_menu_button" msgid="8940478730496610137">"編輯"</string>
<string name="data_usage_warning_title" msgid="3620440638180218181">"數據用量警告"</string>
<!-- Storage description for a USB drive from a specific manufacturer. [CHAR LIMIT=NONE] -->
<string name="storage_usb_drive_label"><xliff:g id="manufacturer" example="Seagate">%s</xliff:g> USB drive</string>
+ <!-- Storage description for a generic CDROM drive. [CHAR LIMIT=NONE] -->
+ <string name="storage_cdrom">CD/DVD drive</string>
+ <!-- Storage description for a CDROM drive from a specific manufacturer. [CHAR LIMIT=NONE] -->
+ <string name="storage_cdrom_label"><xliff:g id="manufacturer" example="ASUS">%s</xliff:g> CD/DVD drive</string>
+
<!-- Storage description for USB storage. [CHAR LIMIT=NONE] -->
<string name="storage_usb">USB storage</string>
<java-symbol type="string" name="storage_sd_card_label" />
<java-symbol type="string" name="storage_usb_drive" />
<java-symbol type="string" name="storage_usb_drive_label" />
+ <java-symbol type="string" name="storage_cdrom" />
+ <java-symbol type="string" name="storage_cdrom_label" />
<java-symbol type="string" name="storage_usb" />
<java-symbol type="drawable" name="ic_eject_24dp" />
}
public static String expectedSchedulerGroup(int prio) {
- return prio < Process.THREAD_PRIORITY_BACKGROUND ? "/" : "/bg_non_interactive";
+ return "/";
}
public void testPassPriorityToService() throws Exception {
key 117 NUMPAD_EQUALS
# key 118 "KEY_KPPLUSMINUS"
key 119 BREAK
-# key 120 (undefined)
+key 120 APP_SWITCH
key 121 NUMPAD_COMMA
key 122 KANA
key 123 EISU
key 124 YEN
-key 125 META_LEFT
-key 126 META_RIGHT
+key 125 HOME
+key 126 HOME
key 127 MENU
key 128 MEDIA_STOP
# key 129 "KEY_AGAIN"
public static final int FILE_TYPE_AAC = 8;
public static final int FILE_TYPE_MKA = 9;
public static final int FILE_TYPE_FLAC = 10;
+ public static final int FILE_TYPE_3GPA = 11;
+ public static final int FILE_TYPE_AC3 = 12;
+ public static final int FILE_TYPE_APE = 13;
+ public static final int FILE_TYPE_WEBMA = 14;
+ public static final int FILE_TYPE_PCM = 15;
+ public static final int FILE_TYPE_DTS = 16;
private static final int FIRST_AUDIO_FILE_TYPE = FILE_TYPE_MP3;
- private static final int LAST_AUDIO_FILE_TYPE = FILE_TYPE_FLAC;
+ private static final int LAST_AUDIO_FILE_TYPE = FILE_TYPE_DTS;
// MIDI file types
- public static final int FILE_TYPE_MID = 11;
- public static final int FILE_TYPE_SMF = 12;
- public static final int FILE_TYPE_IMY = 13;
+ public static final int FILE_TYPE_MID = 18;
+ public static final int FILE_TYPE_SMF = 19;
+ public static final int FILE_TYPE_IMY = 20;
private static final int FIRST_MIDI_FILE_TYPE = FILE_TYPE_MID;
private static final int LAST_MIDI_FILE_TYPE = FILE_TYPE_IMY;
public static final int FILE_TYPE_MP2TS = 28;
public static final int FILE_TYPE_AVI = 29;
public static final int FILE_TYPE_WEBM = 30;
+ public static final int FILE_TYPE_DIVX = 31;
+ public static final int FILE_TYPE_FLV = 32;
+ public static final int FILE_TYPE_RV = 33;
+ public static final int FILE_TYPE_VC1 = 34;
private static final int FIRST_VIDEO_FILE_TYPE = FILE_TYPE_MP4;
- private static final int LAST_VIDEO_FILE_TYPE = FILE_TYPE_WEBM;
+ private static final int LAST_VIDEO_FILE_TYPE = FILE_TYPE_VC1;
// More video file types
public static final int FILE_TYPE_MP2PS = 200;
private static final int LAST_VIDEO_FILE_TYPE2 = FILE_TYPE_QT;
// Image file types
- public static final int FILE_TYPE_JPEG = 31;
- public static final int FILE_TYPE_GIF = 32;
- public static final int FILE_TYPE_PNG = 33;
- public static final int FILE_TYPE_BMP = 34;
- public static final int FILE_TYPE_WBMP = 35;
- public static final int FILE_TYPE_WEBP = 36;
+ public static final int FILE_TYPE_JPEG = 61;
+ public static final int FILE_TYPE_GIF = 62;
+ public static final int FILE_TYPE_PNG = 63;
+ public static final int FILE_TYPE_BMP = 64;
+ public static final int FILE_TYPE_WBMP = 65;
+ public static final int FILE_TYPE_WEBP = 66;
private static final int FIRST_IMAGE_FILE_TYPE = FILE_TYPE_JPEG;
private static final int LAST_IMAGE_FILE_TYPE = FILE_TYPE_WEBP;
addFileType("MPGA", FILE_TYPE_MP3, "audio/mpeg", MtpConstants.FORMAT_MP3);
addFileType("M4A", FILE_TYPE_M4A, "audio/mp4", MtpConstants.FORMAT_MPEG);
addFileType("WAV", FILE_TYPE_WAV, "audio/x-wav", MtpConstants.FORMAT_WAV);
+ addFileType("WAV", FILE_TYPE_PCM, "audio/wav");
addFileType("AMR", FILE_TYPE_AMR, "audio/amr");
addFileType("AWB", FILE_TYPE_AWB, "audio/amr-wb");
if (isWMAEnabled()) {
}
addFileType("OGG", FILE_TYPE_OGG, "audio/ogg", MtpConstants.FORMAT_OGG);
addFileType("OGG", FILE_TYPE_OGG, "application/ogg", MtpConstants.FORMAT_OGG);
+ addFileType("OGA", FILE_TYPE_OGG, "audio/ogg", MtpConstants.FORMAT_OGG);
addFileType("OGA", FILE_TYPE_OGG, "application/ogg", MtpConstants.FORMAT_OGG);
addFileType("AAC", FILE_TYPE_AAC, "audio/aac", MtpConstants.FORMAT_AAC);
addFileType("AAC", FILE_TYPE_AAC, "audio/aac-adts", MtpConstants.FORMAT_AAC);
addFileType("MKA", FILE_TYPE_MKA, "audio/x-matroska");
+ addFileType("AC3", FILE_TYPE_AC3, "audio/ac3");
+ addFileType("APE", FILE_TYPE_APE, "audio/x-ape");
addFileType("MID", FILE_TYPE_MID, "audio/midi");
addFileType("MIDI", FILE_TYPE_MID, "audio/midi");
addFileType("MKV", FILE_TYPE_MKV, "video/x-matroska");
addFileType("WEBM", FILE_TYPE_WEBM, "video/webm");
addFileType("TS", FILE_TYPE_MP2TS, "video/mp2ts");
+ addFileType("MPG", FILE_TYPE_MP2TS, "video/mp2ts");
addFileType("AVI", FILE_TYPE_AVI, "video/avi");
+ addFileType("DIVX", FILE_TYPE_DIVX, "video/divx");
+ addFileType("FLV", FILE_TYPE_FLV, "video/x-flv");
+ addFileType("RM", FILE_TYPE_RV, "video/vnd.rn-realvideo");
+ addFileType("RMVB", FILE_TYPE_RV, "video/vnd.rn-realvideo");
+ addFileType("VC1", FILE_TYPE_VC1, "video/vc1");
if (isWMVEnabled()) {
addFileType("WMV", FILE_TYPE_WMV, "video/x-ms-wmv", MtpConstants.FORMAT_WMV);
int a = findConfigAttrib(egl, display, config,
EGL10.EGL_ALPHA_SIZE, 0);
if ((r == mRedSize) && (g == mGreenSize)
- && (b == mBlueSize) && (a == mAlphaSize)) {
+ && (b == mBlueSize) && (a >= mAlphaSize)) {
return config;
}
}
@Override
public void onDestroy() {
super.onDestroy();
- mBackground = null;
+ if (mBackground != null) {
+ mBackground.recycle();
+ mBackground = null;
+ }
mWallpaperManager.forgetLoadedWallpaper();
}
mEglConfig = chooseEglConfig();
if (mEglConfig == null) {
- throw new RuntimeException("eglConfig not initialized");
+ return false;
}
mEglContext = createContext(mEgl, mEglDisplay, mEglConfig);
final TaskStackView stackView, final TaskView taskView,
final boolean screenPinningRequested, final Rect bounds, final int destinationStack) {
final ActivityOptions opts = ActivityOptions.makeBasic();
+ opts.setLaunchStackId(destinationStack);
if (bounds != null) {
opts.setLaunchBounds(bounds.isEmpty() ? null : bounds);
}
// now trigger the alarms without the lock held
for (int i=0; i<triggerList.size(); i++) {
Alarm alarm = triggerList.get(i);
+ if (alarm.operation == null) continue;
try {
alarm.operation.send();
} catch (PendingIntent.CanceledException e) {
import static com.android.server.input.InputManagerService.SW_HEADPHONE_INSERT;
import static com.android.server.input.InputManagerService.SW_MICROPHONE_INSERT;
import static com.android.server.input.InputManagerService.SW_LINEOUT_INSERT;
+import static com.android.server.input.InputManagerService.SW_VIDEOOUT_INSERT;
import static com.android.server.input.InputManagerService.SW_HEADPHONE_INSERT_BIT;
import static com.android.server.input.InputManagerService.SW_MICROPHONE_INSERT_BIT;
import static com.android.server.input.InputManagerService.SW_LINEOUT_INSERT_BIT;
+import static com.android.server.input.InputManagerService.SW_VIDEOOUT_INSERT_BIT;
import java.io.File;
import java.io.FileReader;
if (mInputManager.getSwitchState(-1, InputDevice.SOURCE_ANY, SW_LINEOUT_INSERT) == 1) {
switchValues |= SW_LINEOUT_INSERT_BIT;
}
+ if (mInputManager.getSwitchState(-1, InputDevice.SOURCE_ANY, SW_VIDEOOUT_INSERT) == 1) {
+ switchValues |= SW_VIDEOOUT_INSERT_BIT;
+ }
notifyWiredAccessoryChanged(0, switchValues,
- SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_LINEOUT_INSERT_BIT);
+ SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_LINEOUT_INSERT_BIT | SW_VIDEOOUT_INSERT_BIT);
}
mObserver.init();
@Override
public void notifyWiredAccessoryChanged(long whenNanos, int switchValues, int switchMask) {
- if (LOG) Slog.v(TAG, "notifyWiredAccessoryChanged: when=" + whenNanos
+ if (LOG) Slog.i(TAG, "notifyWiredAccessoryChanged: when=" + whenNanos
+ " bits=" + switchCodeToString(switchValues, switchMask)
+ " mask=" + Integer.toHexString(switchMask));
int headset;
mSwitchValues = (mSwitchValues & ~switchMask) | switchValues;
switch (mSwitchValues &
- (SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_LINEOUT_INSERT_BIT)) {
+ (SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_LINEOUT_INSERT_BIT | SW_VIDEOOUT_INSERT_BIT)) {
case 0:
headset = 0;
break;
headset = BIT_LINEOUT;
break;
+ case SW_VIDEOOUT_INSERT_BIT:
+ case SW_VIDEOOUT_INSERT_BIT | SW_LINEOUT_INSERT_BIT:
+ headset = BIT_HDMI_AUDIO;
+ break;
+
case SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT:
headset = BIT_HEADSET;
break;
}
updateLocked(NAME_H2W,
- (mHeadsetState & ~(BIT_HEADSET | BIT_HEADSET_NO_MIC | BIT_LINEOUT)) | headset);
+ (mHeadsetState & ~(BIT_HEADSET | BIT_HEADSET_NO_MIC | BIT_LINEOUT | BIT_HDMI_AUDIO)) | headset);
}
}
}
if (LOG) {
- Slog.v(TAG, "headsetName: " + headsetName +
+ Slog.i(TAG, "headsetName: " + headsetName +
(state == 1 ? " connected" : " disconnected"));
}
(switchValues & SW_MICROPHONE_INSERT_BIT) != 0) {
sb.append("SW_MICROPHONE_INSERT");
}
+ if ((switchMask & SW_LINEOUT_INSERT_BIT) != 0 &&
+ (switchValues & SW_LINEOUT_INSERT_BIT) != 0) {
+ sb.append("SW_LINEOUT_INSERT ");
+ }
+ if ((switchMask & SW_VIDEOOUT_INSERT_BIT) != 0 &&
+ (switchValues & SW_VIDEOOUT_INSERT_BIT) != 0) {
+ sb.append("SW_VIDEOOUT_INSERT ");
+ }
return sb.toString();
}
+ ", brightness=" + brightness + ")");
mGlobalDisplayState = state;
mGlobalDisplayBrightness = brightness;
- applyGlobalDisplayStateLocked(mTempDisplayStateWorkQueue);
+ if (state != Display.STATE_OFF) {
+ applyGlobalDisplayStateLocked(mTempDisplayStateWorkQueue);
+ }
}
// Setting the display power state can take hundreds of milliseconds
import android.os.Binder;
import android.os.Bundle;
import android.os.Environment;
+import android.os.FileObserver;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
/** Switch code: Headphone/Microphone Jack. When set, something is inserted. */
public static final int SW_JACK_PHYSICAL_INSERT = 0x07;
+ /** Switch code: Video out jack. When set, something is inserted. */
+ public static final int SW_VIDEOOUT_INSERT = 0x08;
+
/** Switch code: Camera lens cover. When set the lens is covered. */
public static final int SW_CAMERA_LENS_COVER = 0x09;
public static final int SW_MICROPHONE_INSERT_BIT = 1 << SW_MICROPHONE_INSERT;
public static final int SW_LINEOUT_INSERT_BIT = 1 << SW_LINEOUT_INSERT;
public static final int SW_JACK_PHYSICAL_INSERT_BIT = 1 << SW_JACK_PHYSICAL_INSERT;
+ public static final int SW_VIDEOOUT_INSERT_BIT = 1 << SW_VIDEOOUT_INSERT;
public static final int SW_JACK_BITS =
- SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_JACK_PHYSICAL_INSERT_BIT | SW_LINEOUT_INSERT_BIT;
+ SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_JACK_PHYSICAL_INSERT_BIT | SW_LINEOUT_INSERT_BIT | SW_VIDEOOUT_INSERT_BIT;
public static final int SW_CAMERA_LENS_COVER_BIT = 1 << SW_CAMERA_LENS_COVER;
/** Whether to use the dev/input/event or uevent subsystem for the audio jack. */
final boolean mUseDevInputEventForAudioJack;
+ private class TscalObserver extends FileObserver {
+ public TscalObserver() {
+ super("/data/misc/tscal/pointercal", CLOSE_WRITE);
+ }
+
+ @Override
+ public void onEvent(int event, String path) {
+ Slog.i(TAG, "detect pointercal changed");
+ reloadDeviceAliases();
+ }
+ }
+ private final TscalObserver mTscalObserver = new TscalObserver();
+
public InputManagerService(Context context) {
this.mContext = context;
this.mHandler = new InputManagerHandler(DisplayThread.get().getLooper());
new File(doubleTouchGestureEnablePath);
LocalServices.addService(InputManagerInternal.class, new LocalService());
+ mTscalObserver.startWatching();
}
public void setWindowManagerCallbacks(WindowManagerCallbacks callbacks) {
// Only force the default orientation if the screen is xlarge, at least 960dp x 720dp, per
// http://developer.android.com/guide/practices/screens_support.html#range
- mForceDefaultOrientation = longSizeDp >= 960 && shortSizeDp >= 720 &&
+ mForceDefaultOrientation = /* longSizeDp >= 960 && shortSizeDp >= 720 && */
res.getBoolean(com.android.internal.R.bool.config_forceDefaultOrientation) &&
// For debug purposes the next line turns this feature off with:
// $ adb shell setprop config.override_forced_orient true
|| orientation == Surface.ROTATION_270);
final int physWidth = rotated ? mBaseDisplayHeight : mBaseDisplayWidth;
final int physHeight = rotated ? mBaseDisplayWidth : mBaseDisplayHeight;
+ boolean forcedOrientation = mService.mPolicy.isDefaultOrientationForced();
int width = mDisplayInfo.logicalWidth;
- int left = (physWidth - width) / 2;
+ int left = forcedOrientation ? 0 : (physWidth - width) / 2;
int height = mDisplayInfo.logicalHeight;
- int top = (physHeight - height) / 2;
+ int top = forcedOrientation ? 0 : (physHeight - height) / 2;
out.set(left, top, left + width, top + height);
}
int getTouchableRegion(Region region, int flags) {
final boolean modal = (flags & (FLAG_NOT_TOUCH_MODAL | FLAG_NOT_FOCUSABLE)) == 0;
- if (modal && mAppToken != null) {
+ if (modal && mAppToken != null && !mAppToken.appFullscreen) {
// Limit the outer touch to the activity stack region.
flags |= FLAG_NOT_TOUCH_MODAL;
// If this is a modal window we need to dismiss it if it's not full screen and the
#include <linux/ioctl.h>
#include <linux/android_alarm.h>
#include <linux/rtc.h>
+#include <cutils/properties.h>
#include <memory>
int AlarmImplTimerFd::setTime(struct timeval *tv)
{
struct rtc_time rtc;
- struct tm tm, *gmtime_res;
+ struct tm tm, *localtime_res, *gmtime_res;
int fd;
int res;
return res;
}
- gmtime_res = gmtime_r(&tv->tv_sec, &tm);
- if (!gmtime_res) {
- ALOGV("gmtime_r() failed: %s\n", strerror(errno));
- res = -1;
- goto done;
+ // @jide when persist.rtc_local_time is set to 1, we store the localtime to rtc
+ //
+ bool rtc_local_time = property_get_bool("persist.rtc_local_time", false);
+ if (rtc_local_time) {
+ localtime_res = localtime_r(&tv->tv_sec, &tm);
+ if (!localtime_res) {
+ ALOGV("localtime_r() failed: %s\n", strerror(errno));
+ res = -1;
+ goto done;
+ }
+ } else {
+ gmtime_res = gmtime_r(&tv->tv_sec, &tm);
+ if (!gmtime_res) {
+ ALOGV("gmtime_r() failed: %s\n", strerror(errno));
+ res = -1;
+ goto done;
+ }
}
memset(&rtc, 0, sizeof(rtc));