Merge tag 'AU_LINUX_ANDROID_KK.04.04.04.010.104' into HEAD

AU_LINUX_ANDROID_KK.04.04.04.010.104 based on quic/aosp/kk

Change-Id: I90f866085d8b3a594478eaabf280517986821c91
diff --git a/Android.mk b/Android.mk
index 4cfaa31..7c498da 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,6 +1,4 @@
-ifneq (, $(filter aarch64 arm64, $(TARGET_ARCH)))
-    $(info TODOAArch64: $(LOCAL_PATH)/Android.mk: Enable build support for 64 bit)
-else
+ifeq ($(BOARD_HAVE_QCOM_FM),true)
 ifneq (,$(filter $(QCOM_BOARD_PLATFORMS),$(TARGET_BOARD_PLATFORM)))
 LOCAL_PATH:= $(call my-dir)
 LOCAL_DIR_PATH:= $(call my-dir)
@@ -21,4 +19,4 @@
 LOCAL_PATH := $(LOCAL_DIR_PATH)
 include $(LOCAL_PATH)/FMRecord/Android.mk
 endif # is-vendor-board-platform
-endif # TARGET_ARCH
+endif # BOARD_HAVE_QCOM_FM
diff --git a/FMRecord/Android.mk b/FMRecord/Android.mk
index 647b941..b248bc3 100644
--- a/FMRecord/Android.mk
+++ b/FMRecord/Android.mk
@@ -1,3 +1,4 @@
+ifeq ($(BOARD_HAVE_QCOM_FM),true)
 ifneq (,$(filter $(QCOM_BOARD_PLATFORMS),$(TARGET_BOARD_PLATFORM)))
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
@@ -10,5 +11,5 @@
 LOCAL_CERTIFICATE := platform
 LOCAL_PROGUARD_ENABLED := disabled
 include $(BUILD_PACKAGE)
-
 endif
+endif # BOARD_HAVE_QCOM_FM
diff --git a/fmapp2/res/layout-800x480/fmradio.xml b/fmapp2/res/layout-800x480/fmradio.xml
index e209769..0b96bc5 100644
--- a/fmapp2/res/layout-800x480/fmradio.xml
+++ b/fmapp2/res/layout-800x480/fmradio.xml
@@ -56,6 +56,7 @@
             android:drawableLeft="@drawable/count_down"
             android:layout_toRightOf="@+id/btn_onoff"
             android:textSize="14sp"
+            android:textColor="@android:color/white"
             android:layout_marginLeft="5dp"
             android:textStyle="bold"
             android:visibility="invisible"
@@ -71,6 +72,7 @@
             android:layout_toLeftOf="@+id/btn_silent"
             android:layout_toRightOf="@+id/sleep_msg_tv"
             android:textSize="16sp"
+            android:textColor="@android:color/white"
             android:singleLine="true"
             android:textStyle="bold"
             android:text="@string/prog_service_string"/>
diff --git a/fmapp2/res/layout-800x480/fmtransmitter.xml b/fmapp2/res/layout-800x480/fmtransmitter.xml
index f12e808..4754780 100644
--- a/fmapp2/res/layout-800x480/fmtransmitter.xml
+++ b/fmapp2/res/layout-800x480/fmtransmitter.xml
@@ -54,6 +54,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:textSize="15dp"
+            android:textColor="@android:color/white"
             android:layout_centerInParent="true"
             android:layout_alignWithParentIfMissing="true"
             android:text="@string/transmit_msg_string"/>
@@ -86,7 +87,8 @@
                 android:layout_centerInParent="true"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:text="@string/frequency_string"/>
+                android:text="@string/frequency_string"
+                android:textColor="@android:color/white"/>
 
             <ImageView android:id="@+id/btn_forward"
                 android:clickable="true"
@@ -111,6 +113,7 @@
                 android:layout_height="wrap_content"
                 android:textAppearance="?android:attr/textAppearanceMedium"
                 android:textSize="20dp"
+                android:textColor="@android:color/white"
                 android:singleLine="true"
                 android:textStyle="bold"
                 android:paddingLeft="2dp"
diff --git a/fmapp2/res/layout-800x480/station_info.xml b/fmapp2/res/layout-800x480/station_info.xml
index 87a8f7e..c96775a 100644
--- a/fmapp2/res/layout-800x480/station_info.xml
+++ b/fmapp2/res/layout-800x480/station_info.xml
@@ -56,6 +56,7 @@
                 android:layout_marginLeft="20dp"
                 android:textSize="14sp"
                 android:textStyle="bold"
+                android:textColor="@android:color/white"
                 android:clickable="true"
                 android:visibility="invisible"
                 android:text="@string/default_record"/>
@@ -70,6 +71,7 @@
                 android:layout_alignParentRight="true"
                 android:layout_alignBaseline="@id/signal_level"
                 android:textSize="13sp"
+                android:textColor="@android:color/white"
                 android:text="@string/default_audio"/>
 
         </RelativeLayout>
@@ -88,6 +90,7 @@
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:textSize="14sp"
+                android:textColor="@android:color/white"
                 android:paddingTop="2dp"
                 android:paddingRight="2dp"
                 android:paddingBottom="2dp"
@@ -99,6 +102,7 @@
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:textSize="14sp"
+                android:textColor="@android:color/white"
                 android:paddingTop="2dp"
                 android:paddingRight="2dp"
                 android:paddingBottom="2dp"
@@ -120,6 +124,7 @@
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:textSize="25dp"
+                     android:textColor="@android:color/white"
                      android:gravity="center"
                      android:clickable="true"
                      android:focusable="true"
@@ -160,6 +165,7 @@
             android:textSize="15sp"
             android:singleLine="true"
             android:textStyle="bold"
+            android:textColor="@android:color/white"
             android:paddingLeft="2dp"
             android:paddingRight="2dp"
             android:paddingBottom="5dp"
@@ -172,6 +178,7 @@
             android:layout_height="wrap_content"
             android:textAppearance="?android:attr/textAppearanceMedium"
             android:textSize="15sp"
+            android:textColor="@android:color/white"
             android:singleLine="true"
             android:textStyle="bold"
             android:paddingLeft="2dp"
diff --git a/fmapp2/res/layout-land-finger-800x480/fmradio.xml b/fmapp2/res/layout-land-finger-800x480/fmradio.xml
index 4a4519a..4075e8d 100644
--- a/fmapp2/res/layout-land-finger-800x480/fmradio.xml
+++ b/fmapp2/res/layout-land-finger-800x480/fmradio.xml
@@ -56,6 +56,7 @@
             android:layout_toRightOf="@+id/btn_onoff"
             android:textSize="14sp"
             android:textStyle="bold"
+            android:textColor="@android:color/white"
             android:clickable="true"
             android:focusable="true"
             android:visibility="invisible"
@@ -69,6 +70,7 @@
             android:layout_toRightOf="@+id/record_msg_tv"
             android:layout_toLeftOf="@+id/btn_silent"
             android:textSize="16sp"
+            android:textColor="@android:color/white"
             android:singleLine="true"
             android:textStyle="bold"
             android:text="@string/prog_service_string"/>
diff --git a/fmapp2/res/layout-land-finger-800x480/station_info.xml b/fmapp2/res/layout-land-finger-800x480/station_info.xml
index 3f44573..c9b787b 100644
--- a/fmapp2/res/layout-land-finger-800x480/station_info.xml
+++ b/fmapp2/res/layout-land-finger-800x480/station_info.xml
@@ -52,6 +52,7 @@
                 android:layout_height="wrap_content"
                 android:drawableLeft="@drawable/count_down"
                 android:textSize="14sp"
+                android:textColor="@android:color/white"
                 android:layout_marginLeft="25dp"
                 android:textStyle="bold"
                 android:visibility="invisible"
@@ -64,6 +65,7 @@
                 android:textSize="15sp"
                 android:singleLine="true"
                 android:textStyle="bold"
+                android:textColor="@android:color/white"
                 android:paddingLeft="5dp"
                 android:paddingRight="5dp"
                 android:layout_toLeftOf="@+id/sleep_msg_tv"
@@ -80,6 +82,7 @@
                 android:layout_alignParentRight="true"
                 android:layout_alignBaseline="@id/signal_level"
                 android:textSize="13sp"
+                android:textColor="@android:color/white"
                 android:text="@string/default_audio"/>
 
         </RelativeLayout>
@@ -97,6 +100,7 @@
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:textSize="14sp"
+                android:textColor="@android:color/white"
                 android:layout_alignParentTop="true"
                 android:layout_alignParentLeft="true"
                 android:paddingLeft="16dp"
@@ -107,6 +111,7 @@
                 android:layout_height="wrap_content"
                 android:textAppearance="?android:attr/textAppearanceMedium"
                 android:textSize="15sp"
+                android:textColor="@android:color/white"
                 android:singleLine="true"
                 android:textStyle="bold"
                 android:layout_centerInParent="true"
@@ -117,6 +122,7 @@
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:textSize="14sp"
+                android:textColor="@android:color/white"
                 android:layout_alignParentTop="true"
                 android:layout_alignParentRight="true"
                 android:paddingRight="16dp"
@@ -138,6 +144,7 @@
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:textSize="25dp"
+                     android:textColor="@android:color/white"
                      android:gravity="center"
                      android:clickable="true"
                      android:focusable="true"
diff --git a/fmapp2/res/layout/statusbar.xml b/fmapp2/res/layout/statusbar.xml
index 677ed74..47e1a91 100644
--- a/fmapp2/res/layout/statusbar.xml
+++ b/fmapp2/res/layout/statusbar.xml
@@ -45,7 +45,7 @@
 
     <TextView android:id="@+id/frequency"
         android:textAppearance="?android:attr/textAppearanceMediumInverse"
-        android:textColor="#FFFFFFFF"
+        android:textColor="@android:color/black"
         android:focusable="true"
         android:ellipsize="marquee"
         android:singleLine="true"
diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java
index f4ed775..fb8ab23 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadio.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadio.java
@@ -96,6 +96,7 @@
 import com.caf.fmradio.HorizontalNumberPicker.Scale;
 
 import android.content.SharedPreferences;
+import android.graphics.Color;
 
 public class FMRadio extends Activity
 {
@@ -1870,6 +1871,11 @@
          }else {
             setRecordingStartImage();
          }
+         for (int nButton = 0; nButton < MAX_PRESETS_PER_PAGE; nButton++) {
+             if (mPresetButtons[nButton] != null) {
+                  mPresetButtons[nButton].setTextColor(Color.WHITE);
+             }
+        }
       }else {
          if (mRadioTextScroller != null) {
              mRadioTextScroller.stopScroll();
@@ -1877,6 +1883,11 @@
          if (mERadioTextScroller != null) {
              mERadioTextScroller.stopScroll();
          }
+         for (int nButton = 0; nButton < MAX_PRESETS_PER_PAGE; nButton++) {
+             if (mPresetButtons[nButton] != null) {
+                  mPresetButtons[nButton].setTextColor(Color.BLACK);
+             }
+         }
       }
       if (mForwardButton != null) {
           mForwardButton.setVisibility(((bEnable == true) ? View.VISIBLE
@@ -3099,7 +3110,7 @@
                               fmConfigure();
                               break;
                          case Settings.FM_AF_OPTION_CHANGED:
-                              fmAudioOutputMode();
+                              fmAutoAFSwitch();
                               break;
                          case Settings.FM_AUDIO_MODE_CHANGED:
                               fmAudioOutputMode();
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 2de50e7..92ce4ff 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -1058,7 +1058,6 @@
        if((TelephonyManager.CALL_STATE_OFFHOOK == state)||
           (TelephonyManager.CALL_STATE_RINGING == state)) {
            boolean bTempSpeaker = mSpeakerPhoneOn; //need to restore SpeakerPhone
-           boolean bTempMute = mMuted;// need to restore Mute status
            int bTempCall = mCallStatus;//need to restore call status
            if (isFmOn() && fmOff()) {
                if((mServiceInUse) && (mCallbacks != null)) {
@@ -1071,12 +1070,10 @@
                mResumeAfterCall = true;
                mSpeakerPhoneOn = bTempSpeaker;
                mCallStatus = bTempCall;
-               mMuted = bTempMute;
            } else if (!mResumeAfterCall) {
                mResumeAfterCall = false;
                mSpeakerPhoneOn = bTempSpeaker;
                mCallStatus = bTempCall;
-               mMuted = bTempMute;
            }
        }
        else if (state == TelephonyManager.CALL_STATE_IDLE) {
@@ -2065,8 +2062,6 @@
       boolean bCommandSent=true;
       if(isMuted())
           return bCommandSent;
-      if(isCallActive())
-         return false;
       AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
       Log.d(LOGTAG, "mute:");
       if (audioManager != null)
@@ -2085,8 +2080,6 @@
       boolean bCommandSent=true;
       if(!isMuted())
           return bCommandSent;
-      if(isCallActive())
-         return false;
       Log.d(LOGTAG, "unMute:");
       AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
       if (audioManager != null)
diff --git a/fmapp2/src/com/caf/fmradio/FMTransmitterActivity.java b/fmapp2/src/com/caf/fmradio/FMTransmitterActivity.java
index 9798e3e..9fc2d53 100644
--- a/fmapp2/src/com/caf/fmradio/FMTransmitterActivity.java
+++ b/fmapp2/src/com/caf/fmradio/FMTransmitterActivity.java
@@ -39,6 +39,7 @@
 import android.content.IntentFilter;
 import android.content.BroadcastReceiver;
 import android.content.SharedPreferences;
+import android.graphics.Color;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
@@ -916,6 +917,11 @@
          if(mRadioTextScroller != null) {
             mRadioTextScroller.startScroll();
          }
+         for (int nButton = 0; nButton < MAX_PRESETS; nButton++) {
+             if (mPresetButtons[nButton] != null) {
+                 mPresetButtons[nButton].setTextColor(Color.WHITE);
+             }
+         }
       }else {
          if(mTuneStationFrequencyTV != null) {
             mTuneStationFrequencyTV.setOnLongClickListener(null);
@@ -923,6 +929,11 @@
          if(mRadioTextScroller != null) {
             mRadioTextScroller.stopScroll();
          }
+         for (int nButton = 0; nButton < MAX_PRESETS; nButton++) {
+             if (mPresetButtons[nButton] != null) {
+                 mPresetButtons[nButton].setTextColor(Color.BLACK);
+             }
+         }
       }
 
       if(mForwardButton != null) {
diff --git a/fmapp2/src/com/caf/fmradio/FMTransmitterService.java b/fmapp2/src/com/caf/fmradio/FMTransmitterService.java
index e79ee8b..980c968 100644
--- a/fmapp2/src/com/caf/fmradio/FMTransmitterService.java
+++ b/fmapp2/src/com/caf/fmradio/FMTransmitterService.java
@@ -1163,22 +1163,6 @@
         @Override
         public void setEnabled(boolean enabled) {
         }
-
-        @Override
-        public void updateFolderInfoBrowsedPlayer(String stringUri) {
-        }
-
-        @Override
-        public void updateNowPlayingContentChange() {
-        }
-
-        @Override
-        public void playItemResponse(boolean success) {
-        }
-
-        @Override
-        public void updateNowPlayingEntries(long[] playList) {
-        }
    }
 
    class Metadata {
diff --git a/fmapp2/src/com/caf/hc_utils/FrequencyPicker.java b/fmapp2/src/com/caf/hc_utils/FrequencyPicker.java
index c88bb0a..466cc0e 100644
--- a/fmapp2/src/com/caf/hc_utils/FrequencyPicker.java
+++ b/fmapp2/src/com/caf/hc_utils/FrequencyPicker.java
@@ -32,7 +32,7 @@
 import com.caf.fmradio.R;
 import android.widget.NumberPicker;
 import android.widget.NumberPicker.OnValueChangeListener;
-
+import android.graphics.Color;
 /**
  * A view for selecting the frequency
  *
@@ -86,6 +86,7 @@
         mMHzPicker = (NumberPicker) findViewById(R.id.mhz);
         if (mMHzPicker != null) {
            mMHzPicker.setOnLongPressUpdateInterval(100);
+           mMHzPicker.setBackgroundColor(Color.WHITE);
 
            mMHzPicker.setOnValueChangedListener(new OnValueChangeListener() {
               public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
@@ -101,6 +102,7 @@
         mKHzPicker = (NumberPicker) findViewById(R.id.khz);
         if (mKHzPicker != null) {
            mKHzPicker.setOnLongPressUpdateInterval(100);
+           mKHzPicker.setBackgroundColor(Color.WHITE);
            mKHzPicker.setOnValueChangedListener(new OnValueChangeListener() {
               public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
                   mKhz = newVal;
diff --git a/jni/Android.mk b/jni/Android.mk
index d253498..5bc46d3 100644
--- a/jni/Android.mk
+++ b/jni/Android.mk
@@ -1,3 +1,4 @@
+ifeq ($(BOARD_HAVE_QCOM_FM),true)
 ifneq (,$(filter $(QCOM_BOARD_PLATFORMS),$(TARGET_BOARD_PLATFORM)))
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
@@ -16,12 +17,9 @@
 LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
 LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
 
-LOCAL_CFLAGS += -include bionic/libc/kernel/common/linux/types.h
-LOCAL_CFLAGS += -include bionic/libc/kernel/common/linux/posix_types.h
-LOCAL_CFLAGS += -include bionic/libc/kernel/common/linux/socket.h
-
 LOCAL_MODULE := libqcomfm_jni
 LOCAL_MODULE_TAGS := optional
 
 include $(BUILD_SHARED_LIBRARY)
 endif # is-vendor-board-platform
+endif # BOARD_HAVE_QCOM_FM
diff --git a/jni/android_hardware_fm.cpp b/jni/android_hardware_fm.cpp
index b2b0814..8d2e610 100644
--- a/jni/android_hardware_fm.cpp
+++ b/jni/android_hardware_fm.cpp
@@ -445,22 +445,22 @@
 
 /* native interface */
 static jint android_hardware_fmradio_FmReceiverJNI_getBufferNative
- (JNIEnv * env, jobject thiz, jint fd, jbooleanArray buff, jint index)
+ (JNIEnv * env, jobject thiz, jint fd, jbyteArray buff, jint index)
 {
     int err;
     jboolean isCopy;
-    jboolean *bool_buffer;
+    jbyte *byte_buffer;
 
     if ((fd >= 0) && (index >= 0)) {
-        bool_buffer = env->GetBooleanArrayElements(buff, &isCopy);
+        byte_buffer = env->GetByteArrayElements(buff, &isCopy);
         err = FmIoctlsInterface :: get_buffer(fd,
-                                               (char *)bool_buffer,
+                                               (char *)byte_buffer,
                                                STD_BUF_SIZE,
                                                index);
         if (err < 0) {
             err = FM_JNI_FAILURE;
         }
-        env->ReleaseBooleanArrayElements(buff, bool_buffer, 0);
+        env->ReleaseByteArrayElements(buff, byte_buffer, 0);
     } else {
         err = FM_JNI_FAILURE;
     }