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

Commit 8c76978b authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

Merge tag 'android-4.3_r2.1' into cm-10.2

Android 4.3 release 2.1

Conflicts:
	Android.mk
	src/java/com/android/internal/telephony/BaseCommands.java
	src/java/com/android/internal/telephony/CallManager.java
	src/java/com/android/internal/telephony/CommandsInterface.java
	src/java/com/android/internal/telephony/ISms.aidl
	src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
	src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java
	src/java/com/android/internal/telephony/PhoneFactory.java
	src/java/com/android/internal/telephony/RIL.java
	src/java/com/android/internal/telephony/SMSDispatcher.java
	src/java/com/android/internal/telephony/ServiceStateTracker.java
	src/java/com/android/internal/telephony/cat/CatService.java
	src/java/com/android/internal/telephony/cat/ValueParser.java
	src/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
	src/java/com/android/internal/telephony/cdma/CdmaConnection.java
	src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
	src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
	src/java/com/android/internal/telephony/dataconnection/DcTracker.java
	src/java/com/android/internal/telephony/dataconnection/DcTrackerBase.java
	src/java/com/android/internal/telephony/gsm/GSMPhone.java
	src/java/com/android/internal/telephony/gsm/GsmCallTracker.java
	src/java/com/android/internal/telephony/sip/SipCommandInterface.java
	src/java/com/android/internal/telephony/test/SimulatedCommands.java

Change-Id: Ia5d71c6d0526c4b3595e623f763a75fd27ee8744
parents 7b049823 9c430a4d
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -12,23 +12,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# enable this build only when platform library is available
ifeq ($(TARGET_BUILD_JAVA_SUPPORT_LEVEL),platform)

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/src/java
LOCAL_SRC_FILES := \
	src/java/com/android/internal/telephony/ISms.aidl \
    src/java/com/android/internal/telephony/IIccPhoneBook.aidl \
    src/java/com/android/internal/telephony/EventLogTags.logtags \

LOCAL_SRC_FILES += $(call all-java-files-under, src/java)
LOCAL_SRC_FILES := $(call all-java-files-under, src/java) \
	$(call all-Iaidl-files-under, src/java) \
	$(call all-logtags-files-under, src/java)

ifneq ($(BOARD_RIL_CLASS),)
LOCAL_SRC_FILES += $(call find-other-java-files,$(BOARD_RIL_CLASS))
endif


LOCAL_JAVA_LIBRARIES := voip-common
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := telephony-common

@@ -38,3 +38,4 @@ include $(BUILD_JAVA_LIBRARY)
# ============================================================
include $(call all-makefiles-under,$(LOCAL_PATH))

endif # JAVA platform
+4 −0
Original line number Diff line number Diff line
@@ -38,6 +38,10 @@
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************

$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates)

README.txt

0 → 100644
+71 −0
Original line number Diff line number Diff line
This package contains classes used to manage a DataConnection.

A criticial aspect of this class is that most objects in this
package run on the same thread except DataConnectionTracker
This makes processing efficient as it minimizes context
switching and it eliminates issues with multi-threading.

This can be done because all actions are either asynchronous
or are known to be non-blocking and fast. At this time only
DcTesterDeactivateAll takes specific advantage of this
single threading knowledge by using Dcc#mDcListAll so be
very careful when making changes that break this assumption.

A related change was in DataConnectionAc I added code that
checks to see if the caller is on a different thread. If
it is then the AsyncChannel#sendMessageSynchronously is
used. If the caller is on the same thread then a getter
is used. This allows the DCAC to be used from any thread
and was required to fix a bug when Dcc called
PhoneBase#notifyDataConnection which calls DCT#getLinkProperties
and DCT#getLinkCapabilities which call Dcc all on the same
thread. Without this change there was a dead lock when
sendMessageSynchronously blocks.


== Testing ==

The following are Intents that can be sent for testing pruproses on
DEBUGGABLE builds (userdebug, eng)

*) Causes bringUp and retry requests to fail for all DC's

  adb shell am broadcast -a com.android.internal.telephony.dataconnection.action_fail_bringup --ei counter 2 --ei fail_cause -3

*) Causes all DC's to get torn down, simulating a temporary network outage:

  adb shell am broadcast -a com.android.internal.telephony.dataconnection.action_deactivate_all

*) To simplify testing we also have detach and attach simulations below where {x} is gsm, cdma or sip

  adb shell am broadcast -a com.android.internal.telephony.{x}.action_detached
  adb shell am broadcast -a com.android.internal.telephony.{x}.action_attached


== System properties for Testing ==

On debuggable builds (userdebug, eng) you can change additional
settings through system properties.  These properties can be set with
"setprop" for the current boot, or added to local.prop to persist
across boots.

device# setprop key value

device# echo "key=value" >> /data/local.prop
device# chmod 644 /data/local.prop


-- Retry configuration --

You can replace the connection retry configuration.  For example, you
could change it to perform 4 retries at 5 second intervals:

device# setprop test.data_retry_config "5000,5000,5000"


-- Roaming --

You can force the telephony stack to always assume that it's roaming
to verify higher-level framework functionality:

device# setprop telephony.test.forceRoaming true

mockril/Android.mk

deleted100644 → 0
+0 −33
Original line number Diff line number Diff line
#
# Copyright (C) 2010 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.
#
#
ifneq ($(TARGET_BUILD_PDK),true)

LOCAL_PATH:=$(call my-dir)

include $(CLEAR_VARS)

LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_JAVA_LIBRARIES := core framework

LOCAL_STATIC_JAVA_LIBRARIES := librilproto-java

LOCAL_MODULE := mockrilcontroller

include $(BUILD_STATIC_JAVA_LIBRARY)

endif # !PDK
 No newline at end of file
+0 −217
Original line number Diff line number Diff line
/*
 * Copyright (C) 2010, 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.internal.telephony.mockril;

import android.os.Bundle;
import android.util.Log;

import com.android.internal.communication.MsgHeader;
import com.android.internal.communication.Msg;
import com.android.internal.telephony.RilChannel;
import com.android.internal.telephony.ril_proto.RilCtrlCmds;
import com.android.internal.telephony.ril_proto.RilCmds;
import com.google.protobuf.micro.MessageMicro;

import java.io.IOException;

/**
 * Contain a list of commands to control Mock RIL. Before using these commands the devices
 * needs to be set with Mock RIL. Refer to hardware/ril/mockril/README.txt for details.
 *
 */
public class MockRilController {
    private static final String TAG = "MockRILController";
    private RilChannel mRilChannel = null;
    private Msg mMessage = null;

    public MockRilController() throws IOException {
        mRilChannel = RilChannel.makeRilChannel();
    }

    /**
     * Close the channel after the communication is done.
     * This method has to be called after the test is finished.
     */
    public void closeChannel() {
        mRilChannel.close();
    }

    /**
     * Send commands and return true on success
     * @param cmd for MsgHeader
     * @param token for MsgHeader
     * @param status for MsgHeader
     * @param pbData for Msg data
     * @return true if command is sent successfully, false if it fails
     */
    private boolean sendCtrlCommand(int cmd, long token, int status, MessageMicro pbData) {
        try {
            Msg.send(mRilChannel, cmd, token, status, pbData);
        } catch (IOException e) {
            Log.v(TAG, "send command : %d failed: " + e.getStackTrace());
            return false;
        }
        return true;
    }

    /**
     * Get control response
     * @return Msg if response is received, else return null.
     */
    private Msg getCtrlResponse() {
        Msg response = null;
        try {
            response = Msg.recv(mRilChannel);
        } catch (IOException e) {
            Log.v(TAG, "receive response for getRadioState() error: " + e.getStackTrace());
            return null;
        }
        return response;
    }

    /**
     * @return the radio state if it is valid, otherwise return -1
     */
    public int getRadioState() {
        if (!sendCtrlCommand(RilCtrlCmds.CTRL_CMD_GET_RADIO_STATE, 0, 0, null)) {
            return -1;
        }
        Msg response = getCtrlResponse();
        if (response == null) {
            Log.v(TAG, "failed to get response");
            return -1;
        }
        response.printHeader(TAG);
        RilCtrlCmds.CtrlRspRadioState resp =
            response.getDataAs(RilCtrlCmds.CtrlRspRadioState.class);
        int state = resp.getState();
        if ((state >= RilCmds.RADIOSTATE_OFF) && (state <= RilCmds.RADIOSTATE_NV_READY))
            return state;
        else
            return -1;
    }

    /**
     * Set the radio state of mock ril to the given state
     * @param state for given radio state
     * @return true if the state is set successful, false if it fails
     */
    public boolean setRadioState(int state) {
        RilCtrlCmds.CtrlReqRadioState req = new RilCtrlCmds.CtrlReqRadioState();
        if (state < 0 || state > RilCmds.RADIOSTATE_NV_READY) {
            Log.v(TAG, "the give radio state is not valid.");
            return false;
        }
        req.setState(state);
        if (!sendCtrlCommand(RilCtrlCmds.CTRL_CMD_SET_RADIO_STATE, 0, 0, req)) {
            Log.v(TAG, "send set radio state request failed.");
            return false;
        }
        Msg response = getCtrlResponse();
        if (response == null) {
            Log.v(TAG, "failed to get response for setRadioState");
            return false;
        }
        response.printHeader(TAG);
        RilCtrlCmds.CtrlRspRadioState resp =
            response.getDataAs(RilCtrlCmds.CtrlRspRadioState.class);
        int curstate = resp.getState();
        return curstate == state;
    }

    /**
     * Start an incoming call for the given phone number
     *
     * @param phoneNumber is the number to show as incoming call
     * @return true if the incoming call is started successfully, false if it fails.
     */
    public boolean startIncomingCall(String phoneNumber) {
        RilCtrlCmds.CtrlReqSetMTCall req = new RilCtrlCmds.CtrlReqSetMTCall();

        req.setPhoneNumber(phoneNumber);
        if (!sendCtrlCommand(RilCtrlCmds.CTRL_CMD_SET_MT_CALL, 0, 0, req)) {
            Log.v(TAG, "send CMD_SET_MT_CALL request failed");
            return false;
        }
        return true;
    }

    /**
     * Hang up a connection remotelly for the given call fail cause
     *
     * @param connectionID is the connection to be hung up
     * @param failCause is the call fail cause defined in ril.h
     * @return true if the hangup is successful, false if it fails
     */
    public boolean hangupRemote(int connectionId, int failCause) {
        RilCtrlCmds.CtrlHangupConnRemote req = new RilCtrlCmds.CtrlHangupConnRemote();
        req.setConnectionId(connectionId);
        req.setCallFailCause(failCause);

        if (!sendCtrlCommand(RilCtrlCmds.CTRL_CMD_HANGUP_CONN_REMOTE, 0, 0, req)) {
            Log.v(TAG, "send CTRL_CMD_HANGUP_CONN_REMOTE request failed");
            return false;
        }
        return true;
    }

    /**
     * Set call transition flag to the Mock Ril
     *
     * @param flag is a boolean value for the call transiton flag
     *             true: call transition: dialing->alert, alert->active is controlled
     *             false: call transition is automatically handled by Mock Ril
     * @return true if the request is successful, false if it failed to set the flag
     */
    public boolean setCallTransitionFlag(boolean flag) {
        RilCtrlCmds.CtrlSetCallTransitionFlag req = new RilCtrlCmds.CtrlSetCallTransitionFlag();

        req.setFlag(flag);

        if (!sendCtrlCommand(RilCtrlCmds.CTRL_CMD_SET_CALL_TRANSITION_FLAG, 0, 0, req)) {
            Log.v(TAG, "send CTRL_CMD_SET_CALL_TRANSITION_FLAG request failed");
            return false;
        }
        return true;
    }

    /**
     * Set the dialing call to alert if the call transition flag is true
     *
     * @return true if the call transition is successful, false if it fails
     */
    public boolean setDialCallToAlert() {
        if (!sendCtrlCommand(RilCtrlCmds.CTRL_CMD_SET_CALL_ALERT, 0, 0, null)) {
            Log.v(TAG, "send CTRL_CMD_SET_CALL_ALERT request failed");
            return false;
        }
        return true;
   }

   /**
    * Set the alert call to active if the call transition flag is true
    *
    * @return true if the call transition is successful, false if it fails
    */
   public boolean setAlertCallToActive() {
        if (!sendCtrlCommand(RilCtrlCmds.CTRL_CMD_SET_CALL_ACTIVE, 0, 0, null)) {
            Log.v(TAG, "send CTRL_CMD_SET_CALL_ACTIVE request failed");
            return false;
        }
        return true;
   }
}
Loading