Android-x86
Fork

  • R/O
  • HTTP
  • SSH
  • HTTPS

frameworks-native: コミット

frameworks/native


コミットメタ情報

リビジョンcfd43ef931af4a25db5cebee977a91e7016a1c27 (tree)
日時2017-12-11 00:21:22
作者Chih-Wei Huang <cwhuang@linu...>
コミッターChih-Wei Huang

ログメッセージ

Merge branch 'android-ia' into oreo-x86

変更サマリ

差分

--- a/libs/binder/BpBinder.cpp
+++ b/libs/binder/BpBinder.cpp
@@ -160,14 +160,20 @@ status_t BpBinder::dump(int fd, const Vector<String16>& args)
160160 status_t BpBinder::transact(
161161 uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
162162 {
163- // Once a binder has died, it will never come back to life.
163+ // Once a binder has died, it will never come back to life. But
164+ // note that the special case of the global service manager cannot
165+ // die; there is no guarantee in the framework that it will be
166+ // alive before a binder service object is instantiated, so we
167+ // ignore errors for that special object so that
168+ // IServiceManager::addService() calls can be retried.
164169 if (mAlive) {
165170 status_t status = IPCThreadState::self()->transact(
166171 mHandle, code, data, reply, flags);
167- if (status == DEAD_OBJECT) mAlive = 0;
172+ if (status == DEAD_OBJECT)
173+ if (this != ProcessState::self()->getContextObject(NULL).get())
174+ mAlive = 0;
168175 return status;
169176 }
170-
171177 return DEAD_OBJECT;
172178 }
173179
--- a/libs/binder/IServiceManager.cpp
+++ b/libs/binder/IServiceManager.cpp
@@ -29,6 +29,8 @@
2929
3030 #include <unistd.h>
3131
32+#define ADD_SERVICE_RETRY_SECS 10
33+
3234 namespace android {
3335
3436 sp<IServiceManager> defaultServiceManager()
@@ -163,13 +165,26 @@ public:
163165 virtual status_t addService(const String16& name, const sp<IBinder>& service,
164166 bool allowIsolated)
165167 {
166- Parcel data, reply;
167- data.writeInterfaceToken(IServiceManager::getInterfaceDescriptor());
168- data.writeString16(name);
169- data.writeStrongBinder(service);
170- data.writeInt32(allowIsolated ? 1 : 0);
171- status_t err = remote()->transact(ADD_SERVICE_TRANSACTION, data, &reply);
172- return err == NO_ERROR ? reply.readExceptionCode() : err;
168+ status_t err;
169+ for (int i=0; i<ADD_SERVICE_RETRY_SECS; i++) {
170+ Parcel data, reply;
171+ data.writeInterfaceToken(IServiceManager::getInterfaceDescriptor());
172+ data.writeString16(name);
173+ data.writeStrongBinder(service);
174+ data.writeInt32(allowIsolated ? 1 : 0);
175+ err = remote()->transact(ADD_SERVICE_TRANSACTION, data, &reply);
176+ if (err == NO_ERROR)
177+ return reply.readExceptionCode();
178+ if (i != ADD_SERVICE_RETRY_SECS) {
179+ ALOGI("addService() %s failed (err %d - no service manager yet?). Retrying...\n",
180+ String8(name).string(), err);
181+ sleep(1);
182+ } else {
183+ ALOGE("addService() %s failed (err %d). Giving up.\n",
184+ String8(name).string(), err);
185+ }
186+ }
187+ return err;
173188 }
174189
175190 virtual Vector<String16> listServices()
--- a/libs/sensor/Sensor.cpp
+++ b/libs/sensor/Sensor.cpp
@@ -462,10 +462,10 @@ size_t Sensor::getFlattenedSize() const {
462462 sizeof(mRequiredAppOp) + sizeof(mMaxDelay) + sizeof(mFlags) + sizeof(mUuid);
463463
464464 size_t variableSize =
465- sizeof(uint32_t) + FlattenableUtils::align<4>(mName.length()) +
466- sizeof(uint32_t) + FlattenableUtils::align<4>(mVendor.length()) +
467- sizeof(uint32_t) + FlattenableUtils::align<4>(mStringType.length()) +
468- sizeof(uint32_t) + FlattenableUtils::align<4>(mRequiredPermission.length());
465+ sizeof(size_t) + FlattenableUtils::align<sizeof(size_t)>(mName.length()) +
466+ sizeof(size_t) + FlattenableUtils::align<sizeof(size_t)>(mVendor.length()) +
467+ sizeof(size_t) + FlattenableUtils::align<sizeof(size_t)>(mStringType.length()) +
468+ sizeof(size_t) + FlattenableUtils::align<sizeof(size_t)>(mRequiredPermission.length());
469469
470470 return fixedSize + variableSize;
471471 }
--- a/services/inputflinger/EventHub.cpp
+++ b/services/inputflinger/EventHub.cpp
@@ -1127,8 +1127,17 @@ status_t EventHub::unregisterDeviceFromEpollLocked(Device* device) {
11271127 }
11281128
11291129 status_t EventHub::openDeviceLocked(const char *devicePath) {
1130+ return openDeviceLocked(devicePath, false);
1131+}
1132+
1133+status_t EventHub::openDeviceLocked(const char *devicePath, bool ignoreAlreadyOpened) {
11301134 char buffer[80];
11311135
1136+ if (ignoreAlreadyOpened && (getDeviceByPathLocked(devicePath) != 0)) {
1137+ ALOGV("Ignoring device '%s' that has already been opened.", devicePath);
1138+ return 0;
1139+ }
1140+
11321141 ALOGV("Opening device: %s", devicePath);
11331142
11341143 int fd = open(devicePath, O_RDWR | O_CLOEXEC | O_NONBLOCK);
@@ -1338,7 +1347,11 @@ status_t EventHub::openDeviceLocked(const char *devicePath) {
13381347
13391348 // 'Q' key support = cheap test of whether this is an alpha-capable kbd
13401349 if (hasKeycodeLocked(device, AKEYCODE_Q)) {
1341- device->classes |= INPUT_DEVICE_CLASS_ALPHAKEY;
1350+ char value[PROPERTY_VALUE_MAX];
1351+ property_get("ro.ignore_atkbd", value, "0");
1352+ if ((device->identifier.name != "AT Translated Set 2 keyboard") || (!atoi(value))) {
1353+ device->classes |= INPUT_DEVICE_CLASS_ALPHAKEY;
1354+ }
13421355 }
13431356
13441357 // See if this device has a DPAD.
@@ -1711,7 +1724,7 @@ status_t EventHub::readNotifyLocked() {
17111724 if(event->len) {
17121725 strcpy(filename, event->name);
17131726 if(event->mask & IN_CREATE) {
1714- openDeviceLocked(devname);
1727+ openDeviceLocked(devname, true);
17151728 } else {
17161729 ALOGI("Removing device '%s' due to inotify event\n", devname);
17171730 closeDeviceByPathLocked(devname);
--- a/services/inputflinger/EventHub.h
+++ b/services/inputflinger/EventHub.h
@@ -394,6 +394,7 @@ private:
394394 };
395395
396396 status_t openDeviceLocked(const char *devicePath);
397+ status_t openDeviceLocked(const char *devicePath, bool ignoreAlreadyOpened);
397398 void createVirtualKeyboardLocked();
398399 void addDeviceLocked(Device* device);
399400 void assignDescriptorLocked(InputDeviceIdentifier& identifier);
--- a/services/surfaceflinger/EventThread.cpp
+++ b/services/surfaceflinger/EventThread.cpp
@@ -288,11 +288,11 @@ Vector< sp<EventThread::Connection> > EventThread::waitForEvent(
288288 }
289289
290290 // Here we figure out if we need to enable or disable vsyncs
291- if (timestamp && !waitForVSync) {
292- // we received a VSYNC but we have no clients
293- // don't report it, and disable VSYNC events
291+ if (!waitForVSync) {
292+ // we have no clients waiting on next VSYNC
293+ // just disable VSYNC events.
294294 disableVSyncLocked();
295- } else if (!timestamp && waitForVSync) {
295+ } else if (!timestamp) {
296296 // we have at least one client, so we want vsync enabled
297297 // (TODO: this function is called right after we finish
298298 // notifying clients of a vsync, so this call will be made
旧リポジトリブラウザで表示