Call.java
Call.java 文件位于 frameworks/base/telephony/java/com/android/internal/telephony 目录下,它是一个抽象类,描述了phone 中通话方面信息:
刚开始用一个枚举定义了电话的所有状态,为:
IDLE, ACTIVE, HOLDING, DIALING, ALERTING, INCOMING, WAITING, DISCONNECTED, DISCONNECTING;
并且对这些状态进行了归类,具体为:
isActive = !(IDLE || DISCONNECTED || DISCONNECTING);
isRinging = (INCOMING || WAITING);
isDialing = (DIALING || ALERTING);
其中定义的方法有:
1. public abstract List<Connection> getConnection(); //获取Call中所有的Connection
2. public abstract Phone getPhone(); //取得包含Call的Phone
3. public abstract boolean isMultiparty(); //是否有多个通话方
4. public abstract void hangup() throws CallStateException; //挂断通话
5. public boolean hasConnection(Connection c); //判断Call是否包含某个特定的Connection
6. public boolean hasConnections(); //判断Call中是否包含Connection
7. public State getState(); //返回Call的状态
8. public boolean isIdle(); //返回true,如果Call中仅包含disconnected Connection
9. public Connection getEarlistConnection(); //返回最早建立的Connection
10. public long getEarlistCreateTime(); //返回最早的Connection的建立时间
11. public long getEarlistConnectionTime(); //返回最早的Connection的连接时间
12. public boolean isDialingOrAlerting();
13. public boolean isRinging();
14. public Connection getLastestConnection(); //返回最新建立的Connection
15. public void hangupIfAlive(); //Hangup call if it is alive