Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28660992 authored by Matt Garnes's avatar Matt Garnes
Browse files

Merge remote-tracking branch 'caf/LA.BR.1.2.3_1' into caf/cm-12.1

parents 690a9775 acaf9400
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@
            </intent-filter>
            <intent-filter android:priority="1000">
                <action android:name="android.intent.action.CALL_PRIVILEGED" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/phone" />
                <data android:mimeType="vnd.android.cursor.item/phone_v2" />
                <data android:mimeType="vnd.android.cursor.item/person" />
@@ -176,15 +177,6 @@
            </intent-filter>
        </activity-alias>

        <activity-alias android:name="IncomingCallActivity"
                android:targetActivity="CallActivity"
                android:exported="true">
            <intent-filter>
                <action android:name="android.telecom.action.INCOMING_CALL" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity-alias>

        <receiver android:name="TelecomBroadcastReceiver" android:exported="false"
                android:process="system">
            <intent-filter>
@@ -236,9 +228,6 @@
                <action android:name="android.bluetooth.IBluetoothHeadsetPhone" />
            </intent-filter>
        </service>
        <activity android:name="AccountSelection"
            android:theme="@style/Theme.Telecomm.Transparent"
            android:excludeFromRecents="true"/>

        <service android:name=".TelecomService"
                android:singleUser="true"

res/layout/account_list_item.xml

deleted100644 → 0
+0 −54
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
 * Copyright (c) 2014, 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.
 *
 */
-->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="4dp" >

    <ImageView android:id="@+id/icon"
               android:layout_width="48dp"
               android:layout_height="48dp"
               android:tint="@color/dialtacts_secondary_text_color"
               android:scaleType="center" />

    <TextView android:id="@+id/text"
              android:textAppearance="?android:attr/textAppearanceMedium"
              android:gravity="start|center_vertical"
              android:layout_marginLeft="8dp"
              android:layout_width="0dp"
              android:layout_weight="1"
              android:layout_height="match_parent" />
</LinearLayout>
+0 −1
Original line number Diff line number Diff line
@@ -16,5 +16,4 @@

<resources>
    <color name="theme_color">#0288d1</color>
    <color name="dialtacts_secondary_text_color">#737373</color>
</resources>
+0 −1
Original line number Diff line number Diff line
@@ -119,5 +119,4 @@

    <string name="headset_plugin_view_text">Headset is plugged in.</string>
    <string name="headset_plugin_view_title">Headset</string>
    <string name="select_account_dialog_title">Select Account</string>
</resources>
+0 −146
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014, 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 com.android.server.telecom;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.net.Uri;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ImageView;
import android.widget.TextView;


import java.util.List;
import android.os.Bundle;
import android.telecom.TelecomManager;
import android.view.LayoutInflater;

public class AccountSelection extends Activity {

    TelecomManager mTelecomManager;
    List<PhoneAccountHandle> mAccountHandles;
    Uri mHandle;
    boolean mIsSelected = false;

    @Override
    protected void onCreate(Bundle icicle) {
        Log.d(this, "onCreate()...  this = " + this);

        super.onCreate(icicle);
        Intent intent = getIntent();
        Bundle extras = intent.getExtras();
        mHandle = Uri.parse(extras.getString("Handle"));
        mAccountHandles = extras.getParcelableArrayList(android.telecom.
                Call.AVAILABLE_PHONE_ACCOUNTS);
        if (mAccountHandles == null ) {
            finish();
            return;
        }
        mTelecomManager = (TelecomManager) getSystemService(Context.TELECOM_SERVICE);
        final DialogInterface.OnClickListener selectionListener =
                new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                mIsSelected = true;
                CallsManager.getInstance().phoneAccountSelectedForMMI(mHandle,
                        mAccountHandles.get(which));
                finish();
            }
        };
        AlertDialog.Builder builder = new AlertDialog.Builder(AccountSelection.this);

        ListAdapter AccountListAdapter = new AccountListAdapter(
                builder.getContext(),
                R.layout.account_list_item,
                mAccountHandles);

        builder.setTitle(R.string.select_account_dialog_title)
                .setAdapter(AccountListAdapter, selectionListener)
                .setOnCancelListener(new DialogInterface.OnCancelListener() {
                        @Override
                        public void onCancel(DialogInterface dialog) {
                            mIsSelected = false;
                            finish();
                        }
                 }).create().show();
    }

    private class AccountListAdapter extends ArrayAdapter<PhoneAccountHandle> {
        private Context mContext;
        private int mResId;

        public AccountListAdapter(
                Context context, int resource, List<PhoneAccountHandle> accountHandles) {
            super(context, resource, accountHandles);
            mContext = context;
            mResId = resource;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            LayoutInflater inflater = (LayoutInflater)
                    mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

            View rowView = inflater.inflate(mResId, null);
            TextView textView = (TextView) rowView.findViewById(R.id.text);
            ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);

            PhoneAccountHandle accountHandle = getItem(position);
            PhoneAccount account = mTelecomManager.getPhoneAccount(accountHandle);
            textView.setText(account.getLabel());
            return rowView;
        }

    }


    @Override
    protected void onDestroy() {
        Log.d(this, "onDestroy()...  this = " + mIsSelected);
        if(!mIsSelected) {
            CallsManager.getInstance().phoneAccountSelectedForMMI(mHandle, null);
        }
        super.onDestroy();
    }
}
Loading