diff options
author | Santos Cordon <santoscordon@google.com> | 2013-07-12 14:17:55 -0700 |
---|---|---|
committer | Santos Cordon <santoscordon@google.com> | 2013-07-12 14:24:32 -0700 |
commit | b415e4dac14df80fedb73b4be7f72bec455b60b6 (patch) | |
tree | 45adcccdb543c8645fb56cf9c5312b37dfb4a01b /InCallUI | |
parent | 6efcfd472c477797212e3f9d4943df25360854df (diff) |
Adding skeleton code for InCallUI.
Defines a service to communicate with Telephony Service.
Change-Id: I633cbdae529ff61989f30cebfac240ce5a895687
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/Android.mk | 15 | ||||
-rw-r--r-- | InCallUI/AndroidManifest.xml | 35 | ||||
-rw-r--r-- | InCallUI/res/values/strings.xml | 21 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallMonitorService.java | 60 |
4 files changed, 131 insertions, 0 deletions
diff --git a/InCallUI/Android.mk b/InCallUI/Android.mk new file mode 100644 index 000000000..11a315a91 --- /dev/null +++ b/InCallUI/Android.mk @@ -0,0 +1,15 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_STATIC_JAVA_LIBRARIES := com.android.services.telephony.common + +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_PACKAGE_NAME := InCallUI +LOCAL_CERTIFICATE := platform +LOCAL_PRIVELEGED_MODULE := true + +include $(BUILD_PACKAGE) + +# Build the test package +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/InCallUI/AndroidManifest.xml b/InCallUI/AndroidManifest.xml new file mode 100644 index 000000000..b5c47609a --- /dev/null +++ b/InCallUI/AndroidManifest.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2013 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" + package="com.android.incallui" + coreApp="true" > + + <original-package android:name="com.android.incallui" /> + + <application + android:label="@string/inCallLabel" + android:supportsRtl="true"> + + <service android:name="CallMonitorService"> + <intent-filter> + <action android:name="com.android.telephony.common.ICallMonitorService" /> + </intent-filter> + </service> + + </application> +</manifest> diff --git a/InCallUI/res/values/strings.xml b/InCallUI/res/values/strings.xml new file mode 100644 index 000000000..cbf3aea3a --- /dev/null +++ b/InCallUI/res/values/strings.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2013 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + + <!-- Official label for the in-call UI --> + <string name="inCallLabel">InCallUI</string> +</resources> diff --git a/InCallUI/src/com/android/incallui/CallMonitorService.java b/InCallUI/src/com/android/incallui/CallMonitorService.java new file mode 100644 index 000000000..c1325f8ae --- /dev/null +++ b/InCallUI/src/com/android/incallui/CallMonitorService.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.incallui; + +import android.app.Service; +import android.content.Context; +import android.content.Intent; +import android.content.ServiceConnection; +import android.os.Handler; +import android.os.IBinder; +import android.widget.Toast; + +import com.android.services.telephony.common.ICallMonitorService; + +/** + * Service used to listen for call state changes. + */ +public class CallMonitorService extends Service { + + @Override + public void onCreate() { + super.onCreate(); + } + + @Override + public void onDestroy() { + } + + @Override + public IBinder onBind(Intent intent) { + return mBinder; + } + + private final ICallMonitorService.Stub mBinder = new ICallMonitorService.Stub() { + public void onIncomingCall(int callId) { + showAlert("New Call came in: " + callId); + } + }; + + private void showAlert(String message) { + Context context = getApplicationContext(); + int duration = Toast.LENGTH_SHORT; + + Toast.makeText(context, message, duration).show(); + } + } |