summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/jni/android_server_BluetoothEventLoop.cpp17
-rw-r--r--telephony/java/com/android/internal/telephony/SMSDispatcher.java33
2 files changed, 43 insertions, 7 deletions
diff --git a/core/jni/android_server_BluetoothEventLoop.cpp b/core/jni/android_server_BluetoothEventLoop.cpp
index d2e9454..fdc97ee 100644
--- a/core/jni/android_server_BluetoothEventLoop.cpp
+++ b/core/jni/android_server_BluetoothEventLoop.cpp
@@ -564,7 +564,10 @@ static void *eventLoopMain(void *ptr) {
NULL, NULL, NULL, NULL, NULL);
tearDownEventLoop(nat);
nat->vm->DetachCurrentThread();
- shutdown(nat->controlFdR,SHUT_RDWR);
+
+ int fd = nat->controlFdR;
+ nat->controlFdR = 0;
+ close(fd);
return NULL;
}
case EVENT_LOOP_ADD:
@@ -653,9 +656,12 @@ static jboolean startEventLoopNative(JNIEnv *env, jobject object) {
done:
if (JNI_FALSE == result) {
- if (nat->controlFdW || nat->controlFdR) {
- shutdown(nat->controlFdW, SHUT_RDWR);
+ if (nat->controlFdW) {
+ close(nat->controlFdW);
nat->controlFdW = 0;
+ }
+ if (nat->controlFdR) {
+ close(nat->controlFdR);
nat->controlFdR = 0;
}
if (nat->me) env->DeleteGlobalRef(nat->me);
@@ -692,9 +698,10 @@ static void stopEventLoopNative(JNIEnv *env, jobject object) {
nat->watchData = NULL;
nat->pollDataSize = 0;
nat->pollMemberCount = 0;
- shutdown(nat->controlFdW, SHUT_RDWR);
+
+ int fd = nat->controlFdW;
nat->controlFdW = 0;
- nat->controlFdR = 0;
+ close(fd);
}
pthread_mutex_unlock(&(nat->thread_mutex));
#endif // HAVE_BLUETOOTH
diff --git a/telephony/java/com/android/internal/telephony/SMSDispatcher.java b/telephony/java/com/android/internal/telephony/SMSDispatcher.java
index 53c0bef..fc0aa06 100644
--- a/telephony/java/com/android/internal/telephony/SMSDispatcher.java
+++ b/telephony/java/com/android/internal/telephony/SMSDispatcher.java
@@ -109,6 +109,12 @@ public abstract class SMSDispatcher extends Handler {
/** Stop the sending */
static final protected int EVENT_STOP_SENDING = 10;
+ /** Memory status reporting is acknowledged by RIL */
+ static final protected int EVENT_REPORT_MEMORY_STATUS_DONE = 11;
+
+ /** Radio is ON */
+ static final protected int EVENT_RADIO_ON = 12;
+
protected Phone mPhone;
protected Context mContext;
protected ContentResolver mResolver;
@@ -152,6 +158,7 @@ public abstract class SMSDispatcher extends Handler {
private SmsMessageBase.SubmitPduBase mSubmitPduBase;
protected boolean mStorageAvailable = true;
+ protected boolean mReportMemoryStatusPending = false;
protected static int getNextConcatenatedRef() {
sConcatenatedRef += 1;
@@ -235,6 +242,7 @@ public abstract class SMSDispatcher extends Handler {
mCm.setOnNewSMS(this, EVENT_NEW_SMS, null);
mCm.setOnSmsStatus(this, EVENT_NEW_SMS_STATUS_REPORT, null);
mCm.setOnIccSmsFull(this, EVENT_ICC_FULL, null);
+ mCm.registerForOn(this, EVENT_RADIO_ON, null);
// Don't always start message ref at 0.
sConcatenatedRef = new Random().nextInt(256);
@@ -253,6 +261,7 @@ public abstract class SMSDispatcher extends Handler {
mCm.unSetOnNewSMS(this);
mCm.unSetOnSmsStatus(this);
mCm.unSetOnIccSmsFull(this);
+ mCm.unregisterForOn(this);
}
protected void finalize() {
@@ -370,6 +379,26 @@ public abstract class SMSDispatcher extends Handler {
removeMessages(EVENT_ALERT_TIMEOUT, msg.obj);
}
break;
+
+ case EVENT_REPORT_MEMORY_STATUS_DONE:
+ ar = (AsyncResult)msg.obj;
+ if (ar.exception != null) {
+ mReportMemoryStatusPending = true;
+ Log.v(TAG, "Memory status report to modem pending : mStorageAvailable = "
+ + mStorageAvailable);
+ } else {
+ mReportMemoryStatusPending = false;
+ }
+ break;
+
+ case EVENT_RADIO_ON:
+ if (mReportMemoryStatusPending) {
+ Log.v(TAG, "Sending pending memory status report : mStorageAvailable = "
+ + mStorageAvailable);
+ mCm.reportSmsMemoryStatus(mStorageAvailable,
+ obtainMessage(EVENT_REPORT_MEMORY_STATUS_DONE));
+ }
+ break;
}
}
@@ -940,10 +969,10 @@ public abstract class SMSDispatcher extends Handler {
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_DEVICE_STORAGE_LOW)) {
mStorageAvailable = false;
- mCm.reportSmsMemoryStatus(false, null);
+ mCm.reportSmsMemoryStatus(false, obtainMessage(EVENT_REPORT_MEMORY_STATUS_DONE));
} else if (intent.getAction().equals(Intent.ACTION_DEVICE_STORAGE_OK)) {
mStorageAvailable = true;
- mCm.reportSmsMemoryStatus(true, null);
+ mCm.reportSmsMemoryStatus(true, obtainMessage(EVENT_REPORT_MEMORY_STATUS_DONE));
} else {
// Assume the intent is one of the SMS receive intents that
// was sent as an ordered broadcast. Check result and ACK.