Add new CallComposerInfo files
- add new CallComposerInfo class to handle
call composer elements
- add new EXTRAS to handle packing/unpacking
call composer elements
Change-Id: I6010a0bb606c7c35096c1469a899baed2c382824
CRs-Fixed: 2643693
diff --git a/ims/ims-ext-common/src/org/codeaurora/ims/CallComposerInfo.aidl b/ims/ims-ext-common/src/org/codeaurora/ims/CallComposerInfo.aidl
new file mode 100644
index 0000000..813b93a
--- /dev/null
+++ b/ims/ims-ext-common/src/org/codeaurora/ims/CallComposerInfo.aidl
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.codeaurora.ims;
+
+parcelable CallComposerInfo;
diff --git a/ims/ims-ext-common/src/org/codeaurora/ims/CallComposerInfo.java b/ims/ims-ext-common/src/org/codeaurora/ims/CallComposerInfo.java
new file mode 100644
index 0000000..4b1719a
--- /dev/null
+++ b/ims/ims-ext-common/src/org/codeaurora/ims/CallComposerInfo.java
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.codeaurora.ims;
+
+import android.net.Uri;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Parcelable object to handle CallComposer info
+ * @hide
+ */
+
+public class CallComposerInfo implements Parcelable {
+
+ public static final class Location implements Parcelable {
+ public static final float LOCATION_NOT_SET = -1;
+ public static final float DEFAULT_RADIUS = 0;
+ public static final Location UNKNOWN = new Location(LOCATION_NOT_SET, 0, 0);
+
+ private float mRadius;
+ private double mLatitude;
+ private double mLongitude;
+
+ public Location(double latitude, double longitude) {
+ this(DEFAULT_RADIUS, latitude, longitude);
+ }
+
+ public Location(float radius, double latitude, double longitude) {
+ mRadius = radius;
+ mLatitude = latitude;
+ mLongitude = longitude;
+ }
+
+ public Location(Location in) {
+ mRadius = in.getRadius();
+ mLatitude = in.getLatitude();
+ mLongitude = in.getLongitude();
+ }
+
+ public Location(Parcel in) {
+ readFromParcel(in);
+ }
+
+ public float getRadius() {
+ return mRadius;
+ }
+
+ public double getLatitude() {
+ return mLatitude;
+ }
+
+ public double getLongitude() {
+ return mLongitude;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeFloat(mRadius);
+ dest.writeDouble(mLatitude);
+ dest.writeDouble(mLongitude);
+ }
+
+ public void readFromParcel(Parcel in) {
+ mRadius = in.readFloat();
+ mLatitude = in.readDouble();
+ mLongitude = in.readDouble();
+ }
+
+ public static final Creator<Location> CREATOR = new Creator<Location>() {
+ public Location createFromParcel(Parcel in) {
+ return new Location(in);
+ }
+
+ public Location[] newArray(int size) {
+ return new Location[size];
+ }
+ };
+ }
+
+ public static final int PRIORITY_URGENT = 0;
+ public static final int PRIORITY_NORMAL = 1;
+
+ private int mPriority;
+ private String mSubject;
+ private Uri mImageUrl;
+ private Location mLocation;
+
+ public CallComposerInfo(int priority, String subject, Uri imageUrl,
+ Location location) {
+ mPriority = priority;
+ mSubject = subject;
+ mImageUrl = imageUrl;
+ mLocation = location;
+ }
+
+ public CallComposerInfo(int priority, String subject, Uri imageUrl) {
+ this(priority, subject, imageUrl, Location.UNKNOWN);
+ }
+
+ public CallComposerInfo(CallComposerInfo info) {
+ mPriority = info.getPriority();
+ mSubject = info.getSubject();
+ mImageUrl = info.getImageUrl();
+ mLocation = info.getLocation();
+ }
+
+ public CallComposerInfo(Parcel in) {
+ readFromParcel(in);
+ }
+
+ /*
+ * This method returns the priority of the call
+ * Int value: NORMAL, URGENT
+ */
+ public int getPriority() {
+ return mPriority;
+ }
+
+ /*
+ * This method returns the subject of the call
+ */
+ public String getSubject() {
+ return mSubject;
+ }
+
+ /*
+ * This method returns the Url of the image
+ */
+ public Uri getImageUrl() {
+ return mImageUrl;
+ }
+
+ /*
+ * This method returns the location of the call
+ */
+ public Location getLocation() {
+ return mLocation;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flag) {
+ dest.writeInt(mPriority);
+ dest.writeString(mSubject);
+ dest.writeParcelable(mImageUrl, flag);
+ dest.writeParcelable(mLocation, flag);
+ }
+
+ public void readFromParcel(Parcel in) {
+ mPriority = in.readInt();
+ mSubject = in.readString();
+ mImageUrl = in.readParcelable(Uri.class.getClassLoader());
+ mLocation = in.readParcelable(Location.class.getClassLoader());
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ public static final Creator<CallComposerInfo> CREATOR =
+ new Creator<CallComposerInfo>() {
+ @Override
+ public CallComposerInfo createFromParcel(Parcel in) {
+ return new CallComposerInfo(in);
+ }
+
+ @Override
+ public CallComposerInfo[] newArray(int size) {
+ return new CallComposerInfo[size];
+ }
+ };
+
+ public String toString() {
+ return ("{CallComposerInfo Line Info : " + "priority = " +
+ mPriority + " , subject = " + mSubject +
+ " , image url = " + mImageUrl + "}");
+ }
+}
diff --git a/ims/ims-ext-common/src/org/codeaurora/ims/QtiCallConstants.java b/ims/ims-ext-common/src/org/codeaurora/ims/QtiCallConstants.java
index 7389ae3..84661e2 100644
--- a/ims/ims-ext-common/src/org/codeaurora/ims/QtiCallConstants.java
+++ b/ims/ims-ext-common/src/org/codeaurora/ims/QtiCallConstants.java
@@ -325,5 +325,44 @@
public static final int QTI_CONFIG_SMS_APP = 1001;
public static final int QTI_CONFIG_VVM_APP = 1002;
public static final int QTI_CONFIG_VOWIFI_ROAMING_MODE_PREFERENCE = 1003;
+
+ /**
+ * Key values for the Call Composer elements sent through the dial request
+ */
+ // set for MT call composer call
+ // Type: int
+ public static String EXTRA_CALL_COMPOSER_TOKEN = "call_composer_token";
+
+ // set when a call composer call is dialed
+ public static String EXTRA_CALL_COMPOSER_INFO = "call_composer_info";
+
+ // set when subject is added to call composer call
+ // Type: String
+ public static final String EXTRA_CALL_COMPOSER_SUBJECT = "call_composer_subject";
+
+ // set when priority is added to call composer call
+ // Type: int (0 for urgent, 1 for normal)
+ public static String EXTRA_CALL_COMPOSER_PRIORITY = "call_composer_priority";
+
+ // set when image url is added to call composer call
+ // Type: parcelable Uri
+ public static String EXTRA_CALL_COMPOSER_IMAGE = "call_composer_image";
+
+ // set when location is added to call composer call
+ // Type: boolean
+ public static String EXTRA_CALL_COMPOSER_LOCATION = "call_composer_location";
+
+ // set for circle location
+ // Type: float
+ public static String EXTRA_CALL_COMPOSER_LOCATION_RADIUS = "call_composer_location_radius";
+
+ // latitude of the location for the call composer call
+ // Type: double
+ public static String EXTRA_CALL_COMPOSER_LOCATION_LATITUDE = "call_composer_location_latitude";
+
+ // longitude of the location for the call composer call
+ // Type: double
+ public static String EXTRA_CALL_COMPOSER_LOCATION_LONGITUDE =
+ "call_composer_location_longitude";
}
diff --git a/ims/ims-ext-common/src/org/codeaurora/ims/utils/CallComposerInfoUtils.java b/ims/ims-ext-common/src/org/codeaurora/ims/utils/CallComposerInfoUtils.java
new file mode 100644
index 0000000..5793094
--- /dev/null
+++ b/ims/ims-ext-common/src/org/codeaurora/ims/utils/CallComposerInfoUtils.java
@@ -0,0 +1,67 @@
+/* Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.codeaurora.ims.utils;
+
+import android.net.Uri;
+import android.os.Bundle;
+import org.codeaurora.ims.CallComposerInfo;
+import org.codeaurora.ims.QtiCallConstants;
+
+/**
+ * This class contains Call Composer specific utility functions
+ */
+public class CallComposerInfoUtils {
+ /**
+ * Private constructor for CallComposerInfoUtils as we don't want to instantiate this class
+ */
+ private CallComposerInfoUtils() {
+ }
+
+ public static CallComposerInfo buildCallComposerInfo(Bundle extras) {
+ CallComposerInfo.Location location = CallComposerInfo.Location.UNKNOWN;
+ String subject = extras.getString(
+ QtiCallConstants.EXTRA_CALL_COMPOSER_SUBJECT, null);
+ int priority = extras.getInt(
+ QtiCallConstants.EXTRA_CALL_COMPOSER_PRIORITY, CallComposerInfo.PRIORITY_NORMAL);
+ Uri imageUrl = extras.getParcelable(
+ QtiCallConstants.EXTRA_CALL_COMPOSER_IMAGE);
+ if (extras.containsKey(QtiCallConstants.EXTRA_CALL_COMPOSER_LOCATION)) {
+ float radius = extras.getFloat(
+ QtiCallConstants.EXTRA_CALL_COMPOSER_LOCATION_RADIUS,
+ CallComposerInfo.Location.DEFAULT_RADIUS);
+ double latitude = extras.getDouble(
+ QtiCallConstants.EXTRA_CALL_COMPOSER_LOCATION_LATITUDE);
+ double longitude = extras.getDouble(
+ QtiCallConstants.EXTRA_CALL_COMPOSER_LOCATION_LONGITUDE);
+ location = new CallComposerInfo.Location(radius, latitude, longitude);
+ }
+
+ return new CallComposerInfo(priority, subject, imageUrl, location);
+ }
+}