Remove unused classes

This commit is contained in:
Moez Bhatti
2018-06-29 20:27:21 -04:00
parent d58d39911d
commit 0046f0fed8
30 changed files with 0 additions and 5967 deletions
@@ -1,37 +0,0 @@
/*
* Copyright (C) 2008 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 android.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Indicates a constant field value should be exported to be used in the SDK tools.
*
* @hide
*/
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.SOURCE)
public @interface SdkConstant {
public static enum SdkConstantType {
ACTIVITY_INTENT_ACTION, BROADCAST_INTENT_ACTION, SERVICE_ACTION, INTENT_CATEGORY, FEATURE;
}
SdkConstantType value();
}
File diff suppressed because it is too large Load Diff
@@ -1,494 +0,0 @@
/*
* This file is auto-generated. DO NOT MODIFY.
* Original file: frameworks/base/core/java/android/net/INetworkPolicyManager.aidl
*/
package android.net;
/**
* Interface that creates and modifies network policy rules.
* <p/>
* {@hide}
*/
public interface INetworkPolicyManager extends android.os.IInterface {
/**
* Local-side IPC implementation stub class.
*/
public static abstract class Stub extends android.os.Binder implements android.net.INetworkPolicyManager {
private static final java.lang.String DESCRIPTOR = "android.net.INetworkPolicyManager";
/**
* Construct the stub at attach it to the interface.
*/
public Stub() {
this.attachInterface(this, DESCRIPTOR);
}
/**
* Cast an IBinder object into an android.net.INetworkPolicyManager interface,
* generating a proxy if needed.
*/
public static android.net.INetworkPolicyManager asInterface(android.os.IBinder obj) {
if ((obj == null)) {
return null;
}
android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
if (((iin != null) && (iin instanceof android.net.INetworkPolicyManager))) {
return ((android.net.INetworkPolicyManager) iin);
}
return new android.net.INetworkPolicyManager.Stub.Proxy(obj);
}
@Override
public android.os.IBinder asBinder() {
return this;
}
@Override
public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException {
switch (code) {
case INTERFACE_TRANSACTION: {
reply.writeString(DESCRIPTOR);
return true;
}
case TRANSACTION_setUidPolicy: {
data.enforceInterface(DESCRIPTOR);
int _arg0;
_arg0 = data.readInt();
int _arg1;
_arg1 = data.readInt();
this.setUidPolicy(_arg0, _arg1);
reply.writeNoException();
return true;
}
case TRANSACTION_getUidPolicy: {
data.enforceInterface(DESCRIPTOR);
int _arg0;
_arg0 = data.readInt();
int _result = this.getUidPolicy(_arg0);
reply.writeNoException();
reply.writeInt(_result);
return true;
}
case TRANSACTION_getUidsWithPolicy: {
data.enforceInterface(DESCRIPTOR);
int _arg0;
_arg0 = data.readInt();
int[] _result = this.getUidsWithPolicy(_arg0);
reply.writeNoException();
reply.writeIntArray(_result);
return true;
}
case TRANSACTION_isUidForeground: {
data.enforceInterface(DESCRIPTOR);
int _arg0;
_arg0 = data.readInt();
boolean _result = this.isUidForeground(_arg0);
reply.writeNoException();
reply.writeInt(((_result) ? (1) : (0)));
return true;
}
case TRANSACTION_registerListener: {
data.enforceInterface(DESCRIPTOR);
android.net.INetworkPolicyListener _arg0;
_arg0 = android.net.INetworkPolicyListener.Stub.asInterface(data.readStrongBinder());
this.registerListener(_arg0);
reply.writeNoException();
return true;
}
case TRANSACTION_unregisterListener: {
data.enforceInterface(DESCRIPTOR);
android.net.INetworkPolicyListener _arg0;
_arg0 = android.net.INetworkPolicyListener.Stub.asInterface(data.readStrongBinder());
this.unregisterListener(_arg0);
reply.writeNoException();
return true;
}
case TRANSACTION_setNetworkPolicies: {
data.enforceInterface(DESCRIPTOR);
android.net.NetworkPolicy[] _arg0;
_arg0 = data.createTypedArray(android.net.NetworkPolicy.CREATOR);
this.setNetworkPolicies(_arg0);
reply.writeNoException();
return true;
}
case TRANSACTION_getNetworkPolicies: {
data.enforceInterface(DESCRIPTOR);
android.net.NetworkPolicy[] _result = this.getNetworkPolicies();
reply.writeNoException();
reply.writeTypedArray(_result, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
return true;
}
case TRANSACTION_snoozeLimit: {
data.enforceInterface(DESCRIPTOR);
android.net.NetworkTemplate _arg0;
if ((0 != data.readInt())) {
_arg0 = android.net.NetworkTemplate.CREATOR.createFromParcel(data);
} else {
_arg0 = null;
}
this.snoozeLimit(_arg0);
reply.writeNoException();
return true;
}
case TRANSACTION_setRestrictBackground: {
data.enforceInterface(DESCRIPTOR);
boolean _arg0;
_arg0 = (0 != data.readInt());
this.setRestrictBackground(_arg0);
reply.writeNoException();
return true;
}
case TRANSACTION_getRestrictBackground: {
data.enforceInterface(DESCRIPTOR);
boolean _result = this.getRestrictBackground();
reply.writeNoException();
reply.writeInt(((_result) ? (1) : (0)));
return true;
}
case TRANSACTION_getNetworkQuotaInfo: {
data.enforceInterface(DESCRIPTOR);
android.net.NetworkState _arg0;
if ((0 != data.readInt())) {
_arg0 = android.net.NetworkState.CREATOR.createFromParcel(data);
} else {
_arg0 = null;
}
android.net.NetworkQuotaInfo _result = this.getNetworkQuotaInfo(_arg0);
reply.writeNoException();
if ((_result != null)) {
reply.writeInt(1);
_result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
} else {
reply.writeInt(0);
}
return true;
}
case TRANSACTION_isNetworkMetered: {
data.enforceInterface(DESCRIPTOR);
android.net.NetworkState _arg0;
if ((0 != data.readInt())) {
_arg0 = android.net.NetworkState.CREATOR.createFromParcel(data);
} else {
_arg0 = null;
}
boolean _result = this.isNetworkMetered(_arg0);
reply.writeNoException();
reply.writeInt(((_result) ? (1) : (0)));
return true;
}
}
return super.onTransact(code, data, reply, flags);
}
private static class Proxy implements android.net.INetworkPolicyManager {
private android.os.IBinder mRemote;
Proxy(android.os.IBinder remote) {
mRemote = remote;
}
@Override
public android.os.IBinder asBinder() {
return mRemote;
}
/**
* Control UID policies.
*/
@Override
public void setUidPolicy(int uid, int policy) throws android.os.RemoteException {
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeInt(uid);
_data.writeInt(policy);
mRemote.transact(Stub.TRANSACTION_setUidPolicy, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
@Override
public int getUidPolicy(int uid) throws android.os.RemoteException {
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
int _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeInt(uid);
mRemote.transact(Stub.TRANSACTION_getUidPolicy, _data, _reply, 0);
_reply.readException();
_result = _reply.readInt();
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
@Override
public int[] getUidsWithPolicy(int policy) throws android.os.RemoteException {
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
int[] _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeInt(policy);
mRemote.transact(Stub.TRANSACTION_getUidsWithPolicy, _data, _reply, 0);
_reply.readException();
_result = _reply.createIntArray();
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
@Override
public boolean isUidForeground(int uid) throws android.os.RemoteException {
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
boolean _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeInt(uid);
mRemote.transact(Stub.TRANSACTION_isUidForeground, _data, _reply, 0);
_reply.readException();
_result = (0 != _reply.readInt());
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
@Override
public void registerListener(android.net.INetworkPolicyListener listener) throws android.os.RemoteException {
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeStrongBinder((((listener != null)) ? (listener.asBinder()) : (null)));
mRemote.transact(Stub.TRANSACTION_registerListener, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
@Override
public void unregisterListener(android.net.INetworkPolicyListener listener) throws android.os.RemoteException {
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeStrongBinder((((listener != null)) ? (listener.asBinder()) : (null)));
mRemote.transact(Stub.TRANSACTION_unregisterListener, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
/**
* Control network policies atomically.
*/
@Override
public void setNetworkPolicies(android.net.NetworkPolicy[] policies) throws android.os.RemoteException {
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeTypedArray(policies, 0);
mRemote.transact(Stub.TRANSACTION_setNetworkPolicies, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
@Override
public android.net.NetworkPolicy[] getNetworkPolicies() throws android.os.RemoteException {
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
android.net.NetworkPolicy[] _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
mRemote.transact(Stub.TRANSACTION_getNetworkPolicies, _data, _reply, 0);
_reply.readException();
_result = _reply.createTypedArray(android.net.NetworkPolicy.CREATOR);
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
/**
* Snooze limit on policy matching given template.
*/
@Override
public void snoozeLimit(android.net.NetworkTemplate template) throws android.os.RemoteException {
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
if ((template != null)) {
_data.writeInt(1);
template.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
mRemote.transact(Stub.TRANSACTION_snoozeLimit, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
/**
* Control if background data is restricted system-wide.
*/
@Override
public void setRestrictBackground(boolean restrictBackground) throws android.os.RemoteException {
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeInt(((restrictBackground) ? (1) : (0)));
mRemote.transact(Stub.TRANSACTION_setRestrictBackground, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
@Override
public boolean getRestrictBackground() throws android.os.RemoteException {
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
boolean _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
mRemote.transact(Stub.TRANSACTION_getRestrictBackground, _data, _reply, 0);
_reply.readException();
_result = (0 != _reply.readInt());
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
@Override
public android.net.NetworkQuotaInfo getNetworkQuotaInfo(android.net.NetworkState state) throws android.os.RemoteException {
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
android.net.NetworkQuotaInfo _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
if ((state != null)) {
_data.writeInt(1);
state.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
mRemote.transact(Stub.TRANSACTION_getNetworkQuotaInfo, _data, _reply, 0);
_reply.readException();
if ((0 != _reply.readInt())) {
_result = android.net.NetworkQuotaInfo.CREATOR.createFromParcel(_reply);
} else {
_result = null;
}
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
@Override
public boolean isNetworkMetered(android.net.NetworkState state) throws android.os.RemoteException {
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
boolean _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
if ((state != null)) {
_data.writeInt(1);
state.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
mRemote.transact(Stub.TRANSACTION_isNetworkMetered, _data, _reply, 0);
_reply.readException();
_result = (0 != _reply.readInt());
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
}
static final int TRANSACTION_setUidPolicy = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
static final int TRANSACTION_getUidPolicy = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
static final int TRANSACTION_getUidsWithPolicy = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
static final int TRANSACTION_isUidForeground = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
static final int TRANSACTION_registerListener = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4);
static final int TRANSACTION_unregisterListener = (android.os.IBinder.FIRST_CALL_TRANSACTION + 5);
static final int TRANSACTION_setNetworkPolicies = (android.os.IBinder.FIRST_CALL_TRANSACTION + 6);
static final int TRANSACTION_getNetworkPolicies = (android.os.IBinder.FIRST_CALL_TRANSACTION + 7);
static final int TRANSACTION_snoozeLimit = (android.os.IBinder.FIRST_CALL_TRANSACTION + 8);
static final int TRANSACTION_setRestrictBackground = (android.os.IBinder.FIRST_CALL_TRANSACTION + 9);
static final int TRANSACTION_getRestrictBackground = (android.os.IBinder.FIRST_CALL_TRANSACTION + 10);
static final int TRANSACTION_getNetworkQuotaInfo = (android.os.IBinder.FIRST_CALL_TRANSACTION + 11);
static final int TRANSACTION_isNetworkMetered = (android.os.IBinder.FIRST_CALL_TRANSACTION + 12);
}
/**
* Control UID policies.
*/
public void setUidPolicy(int uid, int policy) throws android.os.RemoteException;
public int getUidPolicy(int uid) throws android.os.RemoteException;
public int[] getUidsWithPolicy(int policy) throws android.os.RemoteException;
public boolean isUidForeground(int uid) throws android.os.RemoteException;
public void registerListener(android.net.INetworkPolicyListener listener) throws android.os.RemoteException;
public void unregisterListener(android.net.INetworkPolicyListener listener) throws android.os.RemoteException;
/**
* Control network policies atomically.
*/
public void setNetworkPolicies(android.net.NetworkPolicy[] policies) throws android.os.RemoteException;
public android.net.NetworkPolicy[] getNetworkPolicies() throws android.os.RemoteException;
/**
* Snooze limit on policy matching given template.
*/
public void snoozeLimit(android.net.NetworkTemplate template) throws android.os.RemoteException;
/**
* Control if background data is restricted system-wide.
*/
public void setRestrictBackground(boolean restrictBackground) throws android.os.RemoteException;
public boolean getRestrictBackground() throws android.os.RemoteException;
public android.net.NetworkQuotaInfo getNetworkQuotaInfo(android.net.NetworkState state) throws android.os.RemoteException;
public boolean isNetworkMetered(android.net.NetworkState state) throws android.os.RemoteException;
}
@@ -1,193 +0,0 @@
/*
* Copyright (C) 2011 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 android.net;
import android.os.Parcel;
import android.os.Parcelable;
import com.android.internal.util.Objects;
import static com.android.internal.util.Preconditions.checkNotNull;
/**
* Policy for networks matching a {@link NetworkTemplate}, including usage cycle
* and limits to be enforced.
*
* @hide
*/
public class NetworkPolicy implements Parcelable, Comparable<NetworkPolicy> {
public static final int CYCLE_NONE = -1;
public static final long WARNING_DISABLED = -1;
public static final long LIMIT_DISABLED = -1;
public static final long SNOOZE_NEVER = -1;
public final NetworkTemplate template;
public int cycleDay;
public String cycleTimezone;
public long warningBytes;
public long limitBytes;
public long lastWarningSnooze;
public long lastLimitSnooze;
public boolean metered;
public boolean inferred;
private static final long DEFAULT_MTU = 1500;
@Deprecated
public NetworkPolicy(NetworkTemplate template, int cycleDay, String cycleTimezone,
long warningBytes, long limitBytes, boolean metered) {
this(template, cycleDay, cycleTimezone, warningBytes, limitBytes, SNOOZE_NEVER,
SNOOZE_NEVER, metered, false);
}
public NetworkPolicy(NetworkTemplate template, int cycleDay, String cycleTimezone,
long warningBytes, long limitBytes, long lastWarningSnooze, long lastLimitSnooze,
boolean metered, boolean inferred) {
this.template = checkNotNull(template, "missing NetworkTemplate");
this.cycleDay = cycleDay;
this.cycleTimezone = checkNotNull(cycleTimezone, "missing cycleTimezone");
this.warningBytes = warningBytes;
this.limitBytes = limitBytes;
this.lastWarningSnooze = lastWarningSnooze;
this.lastLimitSnooze = lastLimitSnooze;
this.metered = metered;
this.inferred = inferred;
}
public NetworkPolicy(Parcel in) {
template = in.readParcelable(null);
cycleDay = in.readInt();
cycleTimezone = in.readString();
warningBytes = in.readLong();
limitBytes = in.readLong();
lastWarningSnooze = in.readLong();
lastLimitSnooze = in.readLong();
metered = in.readInt() != 0;
inferred = in.readInt() != 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeParcelable(template, flags);
dest.writeInt(cycleDay);
dest.writeString(cycleTimezone);
dest.writeLong(warningBytes);
dest.writeLong(limitBytes);
dest.writeLong(lastWarningSnooze);
dest.writeLong(lastLimitSnooze);
dest.writeInt(metered ? 1 : 0);
dest.writeInt(inferred ? 1 : 0);
}
@Override
public int describeContents() {
return 0;
}
/**
* Test if given measurement is over {@link #warningBytes}.
*/
public boolean isOverWarning(long totalBytes) {
return warningBytes != WARNING_DISABLED && totalBytes >= warningBytes;
}
/**
* Test if given measurement is near enough to {@link #limitBytes} to be
* considered over-limit.
*/
public boolean isOverLimit(long totalBytes) {
// over-estimate, since kernel will trigger limit once first packet
// trips over limit.
totalBytes += 2 * DEFAULT_MTU;
return limitBytes != LIMIT_DISABLED && totalBytes >= limitBytes;
}
/**
* Clear any existing snooze values, setting to {@link #SNOOZE_NEVER}.
*/
public void clearSnooze() {
lastWarningSnooze = SNOOZE_NEVER;
lastLimitSnooze = SNOOZE_NEVER;
}
/**
* Test if this policy has a cycle defined, after which usage should reset.
*/
public boolean hasCycle() {
return cycleDay != CYCLE_NONE;
}
@Override
public int compareTo(NetworkPolicy another) {
if (another == null || another.limitBytes == LIMIT_DISABLED) {
// other value is missing or disabled; we win
return -1;
}
if (limitBytes == LIMIT_DISABLED || another.limitBytes < limitBytes) {
// we're disabled or other limit is smaller; they win
return 1;
}
return 0;
}
@Override
public int hashCode() {
return Objects.hashCode(template, cycleDay, cycleTimezone, warningBytes, limitBytes,
lastWarningSnooze, lastLimitSnooze, metered, inferred);
}
@Override
public boolean equals(Object obj) {
if (obj instanceof NetworkPolicy) {
final NetworkPolicy other = (NetworkPolicy) obj;
return cycleDay == other.cycleDay && warningBytes == other.warningBytes
&& limitBytes == other.limitBytes
&& lastWarningSnooze == other.lastWarningSnooze
&& lastLimitSnooze == other.lastLimitSnooze && metered == other.metered
&& inferred == other.inferred
&& Objects.equal(cycleTimezone, other.cycleTimezone)
&& Objects.equal(template, other.template);
}
return false;
}
@Override
public String toString() {
final StringBuilder builder = new StringBuilder("NetworkPolicy");
builder.append("[").append(template).append("]:");
builder.append(" cycleDay=").append(cycleDay);
builder.append(", cycleTimezone=").append(cycleTimezone);
builder.append(", warningBytes=").append(warningBytes);
builder.append(", limitBytes=").append(limitBytes);
builder.append(", lastWarningSnooze=").append(lastWarningSnooze);
builder.append(", lastLimitSnooze=").append(lastLimitSnooze);
builder.append(", metered=").append(metered);
builder.append(", inferred=").append(inferred);
return builder.toString();
}
public static final Creator<NetworkPolicy> CREATOR = new Creator<NetworkPolicy>() {
@Override
public NetworkPolicy createFromParcel(Parcel in) {
return new NetworkPolicy(in);
}
@Override
public NetworkPolicy[] newArray(int size) {
return new NetworkPolicy[size];
}
};
}
@@ -1,293 +0,0 @@
/*
* Copyright (C) 2011 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 android.net;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.Signature;
import android.os.RemoteException;
import android.text.format.Time;
import com.google.android.collect.Sets;
import java.io.PrintWriter;
import java.util.HashSet;
import static android.content.pm.PackageManager.GET_SIGNATURES;
import static android.net.NetworkPolicy.CYCLE_NONE;
import static android.text.format.Time.MONTH_DAY;
/**
* Manager for creating and modifying network policy rules.
* <p/>
* {@hide}
*/
public class NetworkPolicyManager {
/**
* No specific network policy, use system default.
*/
public static final int POLICY_NONE = 0x0;
/**
* Reject network usage on metered networks when application in background.
*/
public static final int POLICY_REJECT_METERED_BACKGROUND = 0x1;
/**
* All network traffic should be allowed.
*/
public static final int RULE_ALLOW_ALL = 0x0;
/**
* Reject traffic on metered networks.
*/
public static final int RULE_REJECT_METERED = 0x1;
private static final boolean ALLOW_PLATFORM_APP_POLICY = true;
/**
* {@link Intent} extra that indicates which {@link NetworkTemplate} rule it
* applies to.
*/
public static final String EXTRA_NETWORK_TEMPLATE = "android.net.NETWORK_TEMPLATE";
private INetworkPolicyManager mService;
public NetworkPolicyManager(INetworkPolicyManager service) {
if (service == null) {
throw new IllegalArgumentException("missing INetworkPolicyManager");
}
mService = service;
}
/**
* Set policy flags for specific UID.
*
* @param policy {@link #POLICY_NONE} or combination of flags like
* {@link #POLICY_REJECT_METERED_BACKGROUND}.
*/
public void setUidPolicy(int uid, int policy) {
try {
mService.setUidPolicy(uid, policy);
} catch (RemoteException e) {
}
}
public int getUidPolicy(int uid) {
try {
return mService.getUidPolicy(uid);
} catch (RemoteException e) {
return POLICY_NONE;
}
}
public int[] getUidsWithPolicy(int policy) {
try {
return mService.getUidsWithPolicy(policy);
} catch (RemoteException e) {
return new int[0];
}
}
public void registerListener(INetworkPolicyListener listener) {
try {
mService.registerListener(listener);
} catch (RemoteException e) {
}
}
public void unregisterListener(INetworkPolicyListener listener) {
try {
mService.unregisterListener(listener);
} catch (RemoteException e) {
}
}
public void setNetworkPolicies(NetworkPolicy[] policies) {
try {
mService.setNetworkPolicies(policies);
} catch (RemoteException e) {
}
}
public NetworkPolicy[] getNetworkPolicies() {
try {
return mService.getNetworkPolicies();
} catch (RemoteException e) {
return null;
}
}
public void setRestrictBackground(boolean restrictBackground) {
try {
mService.setRestrictBackground(restrictBackground);
} catch (RemoteException e) {
}
}
public boolean getRestrictBackground() {
try {
return mService.getRestrictBackground();
} catch (RemoteException e) {
return false;
}
}
/**
* Compute the last cycle boundary for the given {@link NetworkPolicy}. For
* example, if cycle day is 20th, and today is June 15th, it will return May
* 20th. When cycle day doesn't exist in current month, it snaps to the 1st
* of following month.
*
* @hide
*/
public static long computeLastCycleBoundary(long currentTime, NetworkPolicy policy) {
if (policy.cycleDay == CYCLE_NONE) {
throw new IllegalArgumentException("Unable to compute boundary without cycleDay");
}
final Time now = new Time(policy.cycleTimezone);
now.set(currentTime);
// first, find cycle boundary for current month
final Time cycle = new Time(now);
cycle.hour = cycle.minute = cycle.second = 0;
snapToCycleDay(cycle, policy.cycleDay);
if (Time.compare(cycle, now) >= 0) {
// cycle boundary is beyond now, use last cycle boundary; start by
// pushing ourselves squarely into last month.
final Time lastMonth = new Time(now);
lastMonth.hour = lastMonth.minute = lastMonth.second = 0;
lastMonth.monthDay = 1;
lastMonth.month -= 1;
lastMonth.normalize(true);
cycle.set(lastMonth);
snapToCycleDay(cycle, policy.cycleDay);
}
return cycle.toMillis(true);
}
/**
* {@hide}
*/
public static long computeNextCycleBoundary(long currentTime, NetworkPolicy policy) {
if (policy.cycleDay == CYCLE_NONE) {
throw new IllegalArgumentException("Unable to compute boundary without cycleDay");
}
final Time now = new Time(policy.cycleTimezone);
now.set(currentTime);
// first, find cycle boundary for current month
final Time cycle = new Time(now);
cycle.hour = cycle.minute = cycle.second = 0;
snapToCycleDay(cycle, policy.cycleDay);
if (Time.compare(cycle, now) <= 0) {
// cycle boundary is before now, use next cycle boundary; start by
// pushing ourselves squarely into next month.
final Time nextMonth = new Time(now);
nextMonth.hour = nextMonth.minute = nextMonth.second = 0;
nextMonth.monthDay = 1;
nextMonth.month += 1;
nextMonth.normalize(true);
cycle.set(nextMonth);
snapToCycleDay(cycle, policy.cycleDay);
}
return cycle.toMillis(true);
}
/**
* Snap to the cycle day for the current month given; when cycle day doesn't
* exist, it snaps to last second of current month.
*
* @hide
*/
public static void snapToCycleDay(Time time, int cycleDay) {
if (cycleDay > time.getActualMaximum(MONTH_DAY)) {
// cycle day isn't valid this month; snap to last second of month
time.month += 1;
time.monthDay = 1;
time.second = -1;
} else {
time.monthDay = cycleDay;
}
time.normalize(true);
}
/**
* Check if given UID can have a {@link #setUidPolicy(int, int)} defined,
* usually to protect critical system services.
*/
@Deprecated
public static boolean isUidValidForPolicy(Context context, int uid) {
if (!ALLOW_PLATFORM_APP_POLICY) {
final PackageManager pm = context.getPackageManager();
final HashSet<Signature> systemSignature;
try {
systemSignature = Sets.newHashSet(
pm.getPackageInfo("android", GET_SIGNATURES).signatures);
} catch (NameNotFoundException e) {
throw new RuntimeException("problem finding system signature", e);
}
try {
// reject apps signed with platform cert
for (String packageName : pm.getPackagesForUid(uid)) {
final HashSet<Signature> packageSignature = Sets.newHashSet(
pm.getPackageInfo(packageName, GET_SIGNATURES).signatures);
if (packageSignature.containsAll(systemSignature)) {
return false;
}
}
} catch (NameNotFoundException e) {
}
}
// nothing found above; we can apply policy to UID
return true;
}
/**
* {@hide}
*/
public static void dumpPolicy(PrintWriter fout, int policy) {
fout.write("[");
if ((policy & POLICY_REJECT_METERED_BACKGROUND) != 0) {
fout.write("REJECT_METERED_BACKGROUND");
}
fout.write("]");
}
/**
* {@hide}
*/
public static void dumpRules(PrintWriter fout, int rules) {
fout.write("[");
if ((rules & RULE_REJECT_METERED) != 0) {
fout.write("REJECT_METERED");
}
fout.write("]");
}
}
@@ -1,455 +0,0 @@
/*
* Copyright (C) 2011 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 android.net;
import android.os.Parcel;
import android.os.Parcelable;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.Objects;
import static android.net.ConnectivityManager.TYPE_ETHERNET;
import static android.net.ConnectivityManager.TYPE_WIFI;
import static android.net.ConnectivityManager.TYPE_WIMAX;
import static android.net.NetworkIdentity.COMBINE_SUBTYPE_ENABLED;
import static android.net.NetworkIdentity.scrubSubscriberId;
import static com.android.internal.util.ArrayUtils.contains;
/**
* Template definition used to generically match {@link NetworkIdentity},
* usually when collecting statistics.
*
* @hide
*/
public class NetworkTemplate implements Parcelable {
public static final int MATCH_MOBILE_ALL = 1;
public static final int MATCH_MOBILE_3G_LOWER = 2;
public static final int MATCH_MOBILE_4G = 3;
public static final int MATCH_WIFI = 4;
public static final int MATCH_ETHERNET = 5;
public static final int MATCH_MOBILE_WILDCARD = 6;
public static final int MATCH_WIFI_WILDCARD = 7;
/**
* Network type is unknown
*/
public static final int NETWORK_TYPE_UNKNOWN = 0;
/**
* Current network is GPRS
*/
public static final int NETWORK_TYPE_GPRS = 1;
/**
* Current network is EDGE
*/
public static final int NETWORK_TYPE_EDGE = 2;
/**
* Current network is UMTS
*/
public static final int NETWORK_TYPE_UMTS = 3;
/**
* Current network is CDMA: Either IS95A or IS95B
*/
public static final int NETWORK_TYPE_CDMA = 4;
/**
* Current network is EVDO revision 0
*/
public static final int NETWORK_TYPE_EVDO_0 = 5;
/**
* Current network is EVDO revision A
*/
public static final int NETWORK_TYPE_EVDO_A = 6;
/**
* Current network is 1xRTT
*/
public static final int NETWORK_TYPE_1xRTT = 7;
/**
* Current network is HSDPA
*/
public static final int NETWORK_TYPE_HSDPA = 8;
/**
* Current network is HSUPA
*/
public static final int NETWORK_TYPE_HSUPA = 9;
/**
* Current network is HSPA
*/
public static final int NETWORK_TYPE_HSPA = 10;
/**
* Current network is iDen
*/
public static final int NETWORK_TYPE_IDEN = 11;
/**
* Current network is EVDO revision B
*/
public static final int NETWORK_TYPE_EVDO_B = 12;
/**
* Current network is LTE
*/
public static final int NETWORK_TYPE_LTE = 13;
/**
* Current network is eHRPD
*/
public static final int NETWORK_TYPE_EHRPD = 14;
/**
* Current network is HSPA+
*/
public static final int NETWORK_TYPE_HSPAP = 15;
/**
* Unknown network class. {@hide}
*/
public static final int NETWORK_CLASS_UNKNOWN = 0;
/**
* Class of broadly defined "2G" networks. {@hide}
*/
public static final int NETWORK_CLASS_2_G = 1;
/**
* Class of broadly defined "3G" networks. {@hide}
*/
public static final int NETWORK_CLASS_3_G = 2;
/**
* Class of broadly defined "4G" networks. {@hide}
*/
public static final int NETWORK_CLASS_4_G = 3;
/**
* Return general class of network type, such as "3G" or "4G". In cases
* where classification is contentious, this method is conservative.
*
* @hide
*/
public static int getNetworkClass(int networkType) {
switch (networkType) {
case NETWORK_TYPE_GPRS:
case NETWORK_TYPE_EDGE:
case NETWORK_TYPE_CDMA:
case NETWORK_TYPE_1xRTT:
case NETWORK_TYPE_IDEN:
return NETWORK_CLASS_2_G;
case NETWORK_TYPE_UMTS:
case NETWORK_TYPE_EVDO_0:
case NETWORK_TYPE_EVDO_A:
case NETWORK_TYPE_HSDPA:
case NETWORK_TYPE_HSUPA:
case NETWORK_TYPE_HSPA:
case NETWORK_TYPE_EVDO_B:
case NETWORK_TYPE_EHRPD:
case NETWORK_TYPE_HSPAP:
return NETWORK_CLASS_3_G;
case NETWORK_TYPE_LTE:
return NETWORK_CLASS_4_G;
default:
return NETWORK_CLASS_UNKNOWN;
}
}
/**
* Set of {@link NetworkInfo#getType()} that reflect data usage.
*/
private static final int[] DATA_USAGE_NETWORK_TYPES = {0};
private static boolean sForceAllNetworkTypes = false;
@VisibleForTesting
public static void forceAllNetworkTypes() {
sForceAllNetworkTypes = true;
}
/**
* Template to match {@link ConnectivityManager#TYPE_MOBILE} networks with
* the given IMSI.
*/
public static NetworkTemplate buildTemplateMobileAll(String subscriberId) {
return new NetworkTemplate(MATCH_MOBILE_ALL, subscriberId, null);
}
/**
* Template to match {@link ConnectivityManager#TYPE_MOBILE} networks with
* the given IMSI that roughly meet a "3G" definition, or lower.
*/
@Deprecated
public static NetworkTemplate buildTemplateMobile3gLower(String subscriberId) {
return new NetworkTemplate(MATCH_MOBILE_3G_LOWER, subscriberId, null);
}
/**
* Template to match {@link ConnectivityManager#TYPE_MOBILE} networks with
* the given IMSI that roughly meet a "4G" definition.
*/
@Deprecated
public static NetworkTemplate buildTemplateMobile4g(String subscriberId) {
return new NetworkTemplate(MATCH_MOBILE_4G, subscriberId, null);
}
/**
* Template to match {@link ConnectivityManager#TYPE_MOBILE} networks,
* regardless of IMSI.
*/
public static NetworkTemplate buildTemplateMobileWildcard() {
return new NetworkTemplate(MATCH_MOBILE_WILDCARD, null, null);
}
/**
* Template to match all {@link ConnectivityManager#TYPE_WIFI} networks,
* regardless of SSID.
*/
public static NetworkTemplate buildTemplateWifiWildcard() {
return new NetworkTemplate(MATCH_WIFI_WILDCARD, null, null);
}
@Deprecated
public static NetworkTemplate buildTemplateWifi() {
return buildTemplateWifiWildcard();
}
/**
* Template to match {@link ConnectivityManager#TYPE_WIFI} networks with the
* given SSID.
*/
public static NetworkTemplate buildTemplateWifi(String networkId) {
return new NetworkTemplate(MATCH_WIFI, null, networkId);
}
/**
* Template to combine all {@link ConnectivityManager#TYPE_ETHERNET} style
* networks together.
*/
public static NetworkTemplate buildTemplateEthernet() {
return new NetworkTemplate(MATCH_ETHERNET, null, null);
}
private final int mMatchRule;
private final String mSubscriberId;
private final String mNetworkId;
public NetworkTemplate(int matchRule, String subscriberId, String networkId) {
mMatchRule = matchRule;
mSubscriberId = subscriberId;
mNetworkId = networkId;
}
private NetworkTemplate(Parcel in) {
mMatchRule = in.readInt();
mSubscriberId = in.readString();
mNetworkId = in.readString();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(mMatchRule);
dest.writeString(mSubscriberId);
dest.writeString(mNetworkId);
}
@Override
public int describeContents() {
return 0;
}
@Override
public String toString() {
final StringBuilder builder = new StringBuilder("NetworkTemplate: ");
builder.append("matchRule=").append(getMatchRuleName(mMatchRule));
if (mSubscriberId != null) {
builder.append(", subscriberId=").append(scrubSubscriberId(mSubscriberId));
}
if (mNetworkId != null) {
builder.append(", networkId=").append(mNetworkId);
}
return builder.toString();
}
@Override
public int hashCode() {
return Objects.hashCode(mMatchRule, mSubscriberId, mNetworkId);
}
@Override
public boolean equals(Object obj) {
if (obj instanceof NetworkTemplate) {
final NetworkTemplate other = (NetworkTemplate) obj;
return mMatchRule == other.mMatchRule
&& Objects.equal(mSubscriberId, other.mSubscriberId)
&& Objects.equal(mNetworkId, other.mNetworkId);
}
return false;
}
public int getMatchRule() {
return mMatchRule;
}
public String getSubscriberId() {
return mSubscriberId;
}
public String getNetworkId() {
return mNetworkId;
}
/**
* Test if given {@link NetworkIdentity} matches this template.
*/
public boolean matches(NetworkIdentity ident) {
switch (mMatchRule) {
case MATCH_MOBILE_ALL:
return matchesMobile(ident);
case MATCH_MOBILE_3G_LOWER:
return matchesMobile3gLower(ident);
case MATCH_MOBILE_4G:
return matchesMobile4g(ident);
case MATCH_WIFI:
return matchesWifi(ident);
case MATCH_ETHERNET:
return matchesEthernet(ident);
case MATCH_MOBILE_WILDCARD:
return matchesMobileWildcard(ident);
case MATCH_WIFI_WILDCARD:
return matchesWifiWildcard(ident);
default:
throw new IllegalArgumentException("unknown network template");
}
}
/**
* Check if mobile network with matching IMSI.
*/
private boolean matchesMobile(NetworkIdentity ident) {
if (ident.mType == TYPE_WIMAX) {
// TODO: consider matching against WiMAX subscriber identity
return true;
} else {
return ((sForceAllNetworkTypes || contains(DATA_USAGE_NETWORK_TYPES, ident.mType))
&& Objects.equal(mSubscriberId, ident.mSubscriberId));
}
}
/**
* Check if mobile network classified 3G or lower with matching IMSI.
*/
private boolean matchesMobile3gLower(NetworkIdentity ident) {
ensureSubtypeAvailable();
if (ident.mType == TYPE_WIMAX) {
return false;
} else if (matchesMobile(ident)) {
switch (getNetworkClass(ident.mSubType)) {
case 0:
case 1:
case 2:
return true;
}
}
return false;
}
/**
* Check if mobile network classified 4G with matching IMSI.
*/
private boolean matchesMobile4g(NetworkIdentity ident) {
ensureSubtypeAvailable();
if (ident.mType == TYPE_WIMAX) {
// TODO: consider matching against WiMAX subscriber identity
return true;
} else if (matchesMobile(ident)) {
switch (getNetworkClass(ident.mSubType)) {
case 3:
return true;
}
}
return false;
}
/**
* Check if matches Wi-Fi network template.
*/
private boolean matchesWifi(NetworkIdentity ident) {
switch (ident.mType) {
case TYPE_WIFI:
return Objects.equal(mNetworkId, ident.mNetworkId);
default:
return false;
}
}
/**
* Check if matches Ethernet network template.
*/
private boolean matchesEthernet(NetworkIdentity ident) {
if (ident.mType == TYPE_ETHERNET) {
return true;
}
return false;
}
private boolean matchesMobileWildcard(NetworkIdentity ident) {
if (ident.mType == TYPE_WIMAX) {
return true;
} else {
return sForceAllNetworkTypes || contains(DATA_USAGE_NETWORK_TYPES, ident.mType);
}
}
private boolean matchesWifiWildcard(NetworkIdentity ident) {
switch (ident.mType) {
case TYPE_WIFI:
case 13:
return true;
default:
return false;
}
}
private static String getMatchRuleName(int matchRule) {
switch (matchRule) {
case MATCH_MOBILE_3G_LOWER:
return "MOBILE_3G_LOWER";
case MATCH_MOBILE_4G:
return "MOBILE_4G";
case MATCH_MOBILE_ALL:
return "MOBILE_ALL";
case MATCH_WIFI:
return "WIFI";
case MATCH_ETHERNET:
return "ETHERNET";
case MATCH_MOBILE_WILDCARD:
return "MOBILE_WILDCARD";
case MATCH_WIFI_WILDCARD:
return "WIFI_WILDCARD";
default:
return "UNKNOWN";
}
}
private static void ensureSubtypeAvailable() {
if (COMBINE_SUBTYPE_ENABLED) {
throw new IllegalArgumentException(
"Unable to enforce 3G_LOWER template on combined data.");
}
}
public static final Creator<NetworkTemplate> CREATOR = new Creator<NetworkTemplate>() {
@Override
public NetworkTemplate createFromParcel(Parcel in) {
return new NetworkTemplate(in);
}
@Override
public NetworkTemplate[] newArray(int size) {
return new NetworkTemplate[size];
}
};
}
@@ -1,56 +0,0 @@
/*
* 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.internal.annotations;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Denotes that the class, method or field has its visibility relaxed so
* that unit tests can access it.
* <p/>
* The <code>visibility</code> argument can be used to specific what the original
* visibility should have been if it had not been made public or package-private for testing.
* The default is to consider the element private.
*/
@Retention(RetentionPolicy.SOURCE)
public @interface VisibleForTesting {
/**
* Intended visibility if the element had not been made public or package-private for
* testing.
*/
enum Visibility {
/**
* The element should be considered protected.
*/
PROTECTED,
/**
* The element should be considered package-private.
*/
PACKAGE,
/**
* The element should be considered private.
*/
PRIVATE
}
/**
* Intended visibility if the element had not been made public or package-private for testing.
* If not specified, one should assume the element originally intended to be private.
*/
Visibility visibility() default Visibility.PRIVATE;
}
@@ -1,94 +0,0 @@
/*
* Copyright (C) 2011 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.net;
import android.app.PendingIntent;
import android.net.NetworkInfo;
import android.os.Parcel;
import android.os.Parcelable;
import com.klinker.android.logger.Log;
/**
* A simple container used to carry information of the ongoing legacy VPN.
* Internal use only.
*
* @hide
*/
public class LegacyVpnInfo implements Parcelable {
private static final String TAG = "LegacyVpnInfo";
public static final int STATE_DISCONNECTED = 0;
public static final int STATE_INITIALIZING = 1;
public static final int STATE_CONNECTING = 2;
public static final int STATE_CONNECTED = 3;
public static final int STATE_TIMEOUT = 4;
public static final int STATE_FAILED = 5;
public String key;
public int state = -1;
public PendingIntent intent;
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeString(key);
out.writeInt(state);
out.writeParcelable(intent, flags);
}
public static final Parcelable.Creator<LegacyVpnInfo> CREATOR =
new Parcelable.Creator<LegacyVpnInfo>() {
@Override
public LegacyVpnInfo createFromParcel(Parcel in) {
LegacyVpnInfo info = new LegacyVpnInfo();
info.key = in.readString();
info.state = in.readInt();
info.intent = in.readParcelable(null);
return info;
}
@Override
public LegacyVpnInfo[] newArray(int size) {
return new LegacyVpnInfo[size];
}
};
/**
* Return best matching {@link LegacyVpnInfo} state based on given
* {@link NetworkInfo}.
*/
public static int stateFromNetworkInfo(NetworkInfo info) {
switch (info.getDetailedState()) {
case CONNECTING:
return STATE_CONNECTING;
case CONNECTED:
return STATE_CONNECTED;
case DISCONNECTED:
return STATE_DISCONNECTED;
case FAILED:
return STATE_FAILED;
default:
Log.w(TAG, "Unhandled state " + info.getDetailedState()
+ " ; treating as disconnected");
return STATE_DISCONNECTED;
}
}
}
@@ -1,115 +0,0 @@
/*
* Copyright (C) 2011 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.net;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Parcel;
import android.os.Parcelable;
import com.android.internal.util.Preconditions;
import java.util.List;
/**
* A simple container used to carry information in VpnBuilder, VpnDialogs,
* and com.android.server.connectivity.Vpn. Internal use only.
*
* @hide
*/
public class VpnConfig implements Parcelable {
public static final String SERVICE_INTERFACE = "android.net.VpnService";
public static final String DIALOGS_PACKAGE = "com.android.vpndialogs";
public static final String LEGACY_VPN = "[Legacy VPN]";
public static Intent getIntentForConfirmation() {
Intent intent = new Intent();
intent.setClassName(DIALOGS_PACKAGE, DIALOGS_PACKAGE + ".ConfirmDialog");
return intent;
}
public static PendingIntent getIntentForStatusPanel(Context context, VpnConfig config) {
Preconditions.checkNotNull(config);
Intent intent = new Intent();
intent.setClassName(DIALOGS_PACKAGE, DIALOGS_PACKAGE + ".ManageDialog");
intent.putExtra("config", config);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY |
Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
}
public String user;
public String interfaze;
public String session;
public int mtu = -1;
public String addresses;
public String routes;
public List<String> dnsServers;
public List<String> searchDomains;
public PendingIntent configureIntent;
public long startTime = -1;
public boolean legacy;
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeString(user);
out.writeString(interfaze);
out.writeString(session);
out.writeInt(mtu);
out.writeString(addresses);
out.writeString(routes);
out.writeStringList(dnsServers);
out.writeStringList(searchDomains);
out.writeParcelable(configureIntent, flags);
out.writeLong(startTime);
out.writeInt(legacy ? 1 : 0);
}
public static final Parcelable.Creator<VpnConfig> CREATOR =
new Parcelable.Creator<VpnConfig>() {
@Override
public VpnConfig createFromParcel(Parcel in) {
VpnConfig config = new VpnConfig();
config.user = in.readString();
config.interfaze = in.readString();
config.session = in.readString();
config.mtu = in.readInt();
config.addresses = in.readString();
config.routes = in.readString();
config.dnsServers = in.createStringArrayList();
config.searchDomains = in.createStringArrayList();
config.configureIntent = in.readParcelable(null);
config.startTime = in.readLong();
config.legacy = in.readInt() != 0;
return config;
}
@Override
public VpnConfig[] newArray(int size) {
return new VpnConfig[size];
}
};
}
@@ -1,202 +0,0 @@
/*
* Copyright (C) 2011 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.net;
import android.os.Parcel;
import android.os.Parcelable;
import com.klinker.android.logger.Log;
import java.nio.charset.Charset;
/**
* Parcel-like entity class for VPN profiles. To keep things simple, all
* fields are package private. Methods are provided for serialization, so
* storage can be implemented easily. Two rules are set for this class.
* First, all fields must be kept non-null. Second, always make a copy
* using clone() before modifying.
*
* @hide
*/
public class VpnProfile implements Cloneable, Parcelable {
private static final String TAG = "VpnProfile";
// Match these constants with R.array.vpn_types.
public static final int TYPE_PPTP = 0;
public static final int TYPE_L2TP_IPSEC_PSK = 1;
public static final int TYPE_L2TP_IPSEC_RSA = 2;
public static final int TYPE_IPSEC_XAUTH_PSK = 3;
public static final int TYPE_IPSEC_XAUTH_RSA = 4;
public static final int TYPE_IPSEC_HYBRID_RSA = 5;
public static final int TYPE_MAX = 5;
// Entity fields.
public final String key; // -1
public String name = ""; // 0
public int type = TYPE_PPTP; // 1
public String server = ""; // 2
public String username = ""; // 3
public String password = ""; // 4
public String dnsServers = ""; // 5
public String searchDomains = ""; // 6
public String routes = ""; // 7
public boolean mppe = true; // 8
public String l2tpSecret = ""; // 9
public String ipsecIdentifier = "";// 10
public String ipsecSecret = ""; // 11
public String ipsecUserCert = ""; // 12
public String ipsecCaCert = ""; // 13
public String ipsecServerCert = "";// 14
// Helper fields.
public boolean saveLogin = false;
public VpnProfile(String key) {
this.key = key;
}
public VpnProfile(Parcel in) {
key = in.readString();
name = in.readString();
type = in.readInt();
server = in.readString();
username = in.readString();
password = in.readString();
dnsServers = in.readString();
searchDomains = in.readString();
routes = in.readString();
mppe = in.readInt() != 0;
l2tpSecret = in.readString();
ipsecIdentifier = in.readString();
ipsecSecret = in.readString();
ipsecUserCert = in.readString();
ipsecCaCert = in.readString();
ipsecServerCert = in.readString();
saveLogin = in.readInt() != 0;
}
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeString(key);
out.writeString(name);
out.writeInt(type);
out.writeString(server);
out.writeString(username);
out.writeString(password);
out.writeString(dnsServers);
out.writeString(searchDomains);
out.writeString(routes);
out.writeInt(mppe ? 1 : 0);
out.writeString(l2tpSecret);
out.writeString(ipsecIdentifier);
out.writeString(ipsecSecret);
out.writeString(ipsecUserCert);
out.writeString(ipsecCaCert);
out.writeString(ipsecServerCert);
out.writeInt(saveLogin ? 1 : 0);
}
public static VpnProfile decode(String key, byte[] value) {
try {
if (key == null) {
return null;
}
String[] values = new String(value, Charset.forName("UTF-8")).split("\0", -1);
// There can be 14 or 15 values in ICS MR1.
if (values.length < 14 || values.length > 15) {
return null;
}
VpnProfile profile = new VpnProfile(key);
profile.name = values[0];
profile.type = Integer.valueOf(values[1]);
if (profile.type < 0 || profile.type > TYPE_MAX) {
return null;
}
profile.server = values[2];
profile.username = values[3];
profile.password = values[4];
profile.dnsServers = values[5];
profile.searchDomains = values[6];
profile.routes = values[7];
profile.mppe = Boolean.valueOf(values[8]);
profile.l2tpSecret = values[9];
profile.ipsecIdentifier = values[10];
profile.ipsecSecret = values[11];
profile.ipsecUserCert = values[12];
profile.ipsecCaCert = values[13];
profile.ipsecServerCert = (values.length > 14) ? values[14] : "";
profile.saveLogin = !profile.username.isEmpty() || !profile.password.isEmpty();
return profile;
} catch (Exception e) {
// ignore
}
return null;
}
public byte[] encode() {
StringBuilder builder = new StringBuilder(name);
builder.append('\0').append(type);
builder.append('\0').append(server);
builder.append('\0').append(saveLogin ? username : "");
builder.append('\0').append(saveLogin ? password : "");
builder.append('\0').append(dnsServers);
builder.append('\0').append(searchDomains);
builder.append('\0').append(routes);
builder.append('\0').append(mppe);
builder.append('\0').append(l2tpSecret);
builder.append('\0').append(ipsecIdentifier);
builder.append('\0').append(ipsecSecret);
builder.append('\0').append(ipsecUserCert);
builder.append('\0').append(ipsecCaCert);
builder.append('\0').append(ipsecServerCert);
return builder.toString().getBytes(Charset.forName("UTF-8"));
}
/**
* Test if profile is valid for lockdown, which requires IPv4 address for
* both server and DNS. Server hostnames would require using DNS before
* connection.
*/
public boolean isValidLockdownProfile() {
try {
return true;
} catch (IllegalArgumentException e) {
Log.w(TAG, "Invalid address", e);
return false;
}
}
public static final Creator<VpnProfile> CREATOR = new Creator<VpnProfile>() {
@Override
public VpnProfile createFromParcel(Parcel in) {
return new VpnProfile(in);
}
@Override
public VpnProfile[] newArray(int size) {
return new VpnProfile[size];
}
};
@Override
public int describeContents() {
return 0;
}
}
@@ -1,36 +0,0 @@
/*
* Copyright (C) 2006 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;
/**
* {@hide}
*/
@SuppressWarnings("serial")
public class EncodeException extends Exception {
public EncodeException() {
super();
}
public EncodeException(String s) {
super(s);
}
public EncodeException(char c) {
super("Unencodable char: '" + c + "'");
}
}
File diff suppressed because it is too large Load Diff
@@ -1,83 +0,0 @@
/*
* 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.internal.telephony;
/**
* SMS Constants and must be the same as the corresponding
* deprecated version in SmsMessage.
*
* @hide
*/
public class SmsConstants {
/**
* User data text encoding code unit size
*/
public static final int ENCODING_UNKNOWN = 0;
public static final int ENCODING_7BIT = 1;
public static final int ENCODING_8BIT = 2;
public static final int ENCODING_16BIT = 3;
/**
* The maximum number of payload septets per message
*/
public static final int MAX_USER_DATA_SEPTETS = 160;
/**
* The maximum number of payload septets per message if a user data header
* is present. This assumes the header only contains the
* CONCATENATED_8_BIT_REFERENCE element.
*/
public static final int MAX_USER_DATA_SEPTETS_WITH_HEADER = 153;
/**
* This value is not defined in global standard. Only in Korea, this is used.
*/
public static final int ENCODING_KSC5601 = 4;
/**
* The maximum number of payload bytes per message
*/
public static final int MAX_USER_DATA_BYTES = 140;
/**
* The maximum number of payload bytes per message if a user data header
* is present. This assumes the header only contains the
* CONCATENATED_8_BIT_REFERENCE element.
*/
public static final int MAX_USER_DATA_BYTES_WITH_HEADER = 134;
/**
* SMS Class enumeration.
* See TS 23.038.
*/
public enum MessageClass {
UNKNOWN, CLASS_0, CLASS_1, CLASS_2, CLASS_3;
}
/**
* Indicates a 3GPP format SMS message.
*
* @hide pending API council approval
*/
public static final String FORMAT_3GPP = "3gpp";
/**
* Indicates a 3GPP2 format SMS message.
*
* @hide pending API council approval
*/
public static final String FORMAT_3GPP2 = "3gpp2";
}
@@ -1,92 +0,0 @@
/*
* Copyright (C) 2007 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.google.android.collect;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.SortedSet;
import java.util.TreeSet;
/**
* Provides static methods for creating mutable {@code Set} instances easily and
* other static methods for working with Sets.
*/
public class Sets {
/**
* Creates an empty {@code HashSet} instance.
* <p/>
* <p><b>Note:</b> if {@code E} is an {@link Enum} type, use {@link
* EnumSet#noneOf} instead.
* <p/>
* <p><b>Note:</b> if you only need an <i>immutable</i> empty Set,
* use {@link Collections#emptySet} instead.
*
* @return a newly-created, initially-empty {@code HashSet}
*/
public static <K> HashSet<K> newHashSet() {
return new HashSet<K>();
}
/**
* Creates a {@code HashSet} instance containing the given elements.
* <p/>
* <p><b>Note:</b> due to a bug in javac 1.5.0_06, we cannot support the
* following:
* <p/>
* <p>{@code Set<Base> set = Sets.newHashSet(sub1, sub2);}
* <p/>
* <p>where {@code sub1} and {@code sub2} are references to subtypes of {@code
* Base}, not of {@code Base} itself. To get around this, you must use:
* <p/>
* <p>{@code Set<Base> set = Sets.<Base>newHashSet(sub1, sub2);}
*
* @param elements the elements that the set should contain
* @return a newly-created {@code HashSet} containing those elements (minus
* duplicates)
*/
public static <E> HashSet<E> newHashSet(E... elements) {
int capacity = elements.length * 4 / 3 + 1;
HashSet<E> set = new HashSet<E>(capacity);
Collections.addAll(set, elements);
return set;
}
/**
* Creates an empty {@code SortedSet} instance.
*
* @return a newly-created, initially-empty {@code SortedSet}.
*/
public static <E> SortedSet<E> newSortedSet() {
return new TreeSet<E>();
}
/**
* Creates a {@code SortedSet} instance containing the given elements.
*
* @param elements the elements that the set should contain
* @return a newly-created {@code SortedSet} containing those elements (minus
* duplicates)
*/
public static <E> SortedSet<E> newSortedSet(E... elements) {
SortedSet<E> set = new TreeSet<E>();
Collections.addAll(set, elements);
return set;
}
}
@@ -1,41 +0,0 @@
/*
* Copyright (c) 2000 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
* details.
*/
package org.w3c.dom.smil;
import org.w3c.dom.DOMException;
import org.w3c.dom.NodeList;
/**
* This interface defines a time container with semantics based upon par, but
* with the additional constraint that only one child element may play at a
* time.
*/
public interface ElementExclusiveTimeContainer extends ElementTimeContainer {
/**
* Controls the end of the container. Need to address thr id-ref value.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public String getEndSync();
public void setEndSync(String endSync)
throws DOMException;
/**
* This should support another method to get the ordered collection of
* paused elements (the paused stack) at a given point in time.
* @return All paused elements at the current time.
*/
public NodeList getPausedElements();
}
@@ -1,49 +0,0 @@
/*
* Copyright (c) 2000 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
* details.
*/
package org.w3c.dom.smil;
/**
* The synchronization behavior extension.
*/
public interface ElementSyncBehavior {
/**
* The runtime synchronization behavior for an element.
*/
public String getSyncBehavior();
/**
* The sync tolerance for the associated element. It has an effect only if
* the element has <code>syncBehavior="locked"</code> .
*/
public float getSyncTolerance();
/**
* Defines the default value for the runtime synchronization behavior for
* an element, and all descendents.
*/
public String getDefaultSyncBehavior();
/**
* Defines the default value for the sync tolerance for an element, and
* all descendents.
*/
public float getDefaultSyncTolerance();
/**
* If set to true, forces the time container playback to sync to this
* element.
*/
public boolean getSyncMaster();
}
@@ -1,38 +0,0 @@
/*
* Copyright (c) 2000 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
* details.
*/
package org.w3c.dom.smil;
/**
* This interface define the set of animation target extensions.
*/
public interface ElementTargetAttributes {
/**
* The name of the target attribute.
*/
public String getAttributeName();
public void setAttributeName(String attributeName);
// attributeTypes
public static final short ATTRIBUTE_TYPE_AUTO = 0;
public static final short ATTRIBUTE_TYPE_CSS = 1;
public static final short ATTRIBUTE_TYPE_XML = 2;
/**
* A code representing the value of the attributeType attribute, as
* defined above. Default value is <code>ATTRIBUTE_TYPE_CODE</code> .
*/
public short getAttributeType();
public void setAttributeType(short attributeType);
}
@@ -1,83 +0,0 @@
/*
* Copyright (c) 2000 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
* details.
*/
package org.w3c.dom.smil;
import org.w3c.dom.DOMException;
/**
* Defines the test attributes interface. See the Test attributes definition
* .
*/
public interface ElementTest {
/**
* The systemBitrate value.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public int getSystemBitrate();
public void setSystemBitrate(int systemBitrate)
throws DOMException;
/**
* The systemCaptions value.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public boolean getSystemCaptions();
public void setSystemCaptions(boolean systemCaptions)
throws DOMException;
/**
* The systemLanguage value.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public String getSystemLanguage();
public void setSystemLanguage(String systemLanguage)
throws DOMException;
/**
* The result of the evaluation of the systemRequired attribute.
*/
public boolean getSystemRequired();
/**
* The result of the evaluation of the systemScreenSize attribute.
*/
public boolean getSystemScreenSize();
/**
* The result of the evaluation of the systemScreenDepth attribute.
*/
public boolean getSystemScreenDepth();
/**
* The value of the systemOverdubOrSubtitle attribute.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public String getSystemOverdubOrSubtitle();
public void setSystemOverdubOrSubtitle(String systemOverdubOrSubtitle)
throws DOMException;
/**
* The value of the systemAudioDesc attribute.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public boolean getSystemAudioDesc();
public void setSystemAudioDesc(boolean systemAudioDesc)
throws DOMException;
}
@@ -1,103 +0,0 @@
/*
* Copyright (c) 2000 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
* details.
*/
package org.w3c.dom.smil;
import org.w3c.dom.DOMException;
/**
*/
public interface ElementTimeControl {
/**
* Causes this element to begin the local timeline (subject to sync
* constraints).
* @return <code>true</code> if the method call was successful and the
* element was begun. <code>false</code> if the method call failed.
* Possible reasons for failure include: The element doesn't support
* the <code>beginElement</code> method. (the <code>begin</code>
* attribute is not set to <code>"indefinite"</code> ) The element is
* already active and can't be restart when it is active. (the
* <code>restart</code> attribute is set to <code>"whenNotActive"</code>
* ) The element is active or has been active and can't be restart.
* (the <code>restart</code> attribute is set to <code>"never"</code> ).
*
* @exception DOMException
* SYNTAX_ERR: The element was not defined with the appropriate syntax
* to allow <code>beginElement</code> calls.
*/
public boolean beginElement()
throws DOMException;
/**
* Causes this element to begin the local timeline (subject to sync
* constraints), at the passed offset from the current time when the
* method is called. If the offset is &gt;= 0, the semantics are
* equivalent to an event-base begin with the specified offset. If the
* offset is &lt; 0, the semantics are equivalent to beginElement(), but
* the element active duration is evaluated as though the element had
* begun at the passed (negative) offset from the current time when the
* method is called.
* @param offset The offset in seconds at which to begin the element.
* @return <code>true</code> if the method call was successful and the
* element was begun. <code>false</code> if the method call failed.
* Possible reasons for failure include: The element doesn't support
* the <code>beginElementAt</code> method. (the <code>begin</code>
* attribute is not set to <code>"indefinite"</code> ) The element is
* already active and can't be restart when it is active. (the
* <code>restart</code> attribute is set to <code>"whenNotActive"</code>
* ) The element is active or has been active and can't be restart.
* (the <code>restart</code> attribute is set to <code>"never"</code> ).
*
* @exception DOMException
* SYNTAX_ERR: The element was not defined with the appropriate syntax
* to allow <code>beginElementAt</code> calls.
*/
public boolean beginElementAt(float offset)
throws DOMException;
/**
* Causes this element to end the local timeline (subject to sync
* constraints).
* @return <code>true</code> if the method call was successful and the
* element was ended. <code>false</code> if method call failed.
* Possible reasons for failure include: The element doesn't support
* the <code>endElement</code> method. (the <code>end</code> attribute
* is not set to <code>"indefinite"</code> ) The element is not active.
*
* @exception DOMException
* SYNTAX_ERR: The element was not defined with the appropriate syntax
* to allow <code>endElement</code> calls.
*/
public boolean endElement()
throws DOMException;
/**
* Causes this element to end the local timeline (subject to sync
* constraints) at the specified offset from the current time when the
* method is called.
* @param offset The offset in seconds at which to end the element. Must
* be &gt;= 0.
* @return <code>true</code> if the method call was successful and the
* element was ended. <code>false</code> if method call failed.
* Possible reasons for failure include: The element doesn't support
* the <code>endElementAt</code> method. (the <code>end</code>
* attribute is not set to <code>"indefinite"</code> ) The element is
* not active.
* @exception DOMException
* SYNTAX_ERR: The element was not defined with the appropriate syntax
* to allow <code>endElementAt</code> calls.
*/
public boolean endElementAt(float offset)
throws DOMException;
}
@@ -1,75 +0,0 @@
/*
* Copyright (c) 2000 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
* details.
*/
package org.w3c.dom.smil;
import org.w3c.dom.DOMException;
/**
* This interface support use-cases commonly associated with animation.
* "accelerate" and "decelerate" are float values in the timing draft and
* percentage values even in this draft if both of them represent a
* percentage.
*/
public interface ElementTimeManipulation {
/**
* Defines the playback speed of element time. The value is specified as
* a multiple of normal (parent time container) play speed. Legal values
* are signed floating point values. Zero values are not allowed. The
* default is <code>1.0</code> (no modification of speed).
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public float getSpeed();
public void setSpeed(float speed)
throws DOMException;
/**
* The percentage value of the simple acceleration of time for the
* element. Allowed values are from <code>0</code> to <code>100</code> .
* Default value is <code>0</code> (no acceleration).
* <br> The sum of the values for accelerate and decelerate must not exceed
* 100. If it does, the deceleration value will be reduced to make the
* sum legal.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public float getAccelerate();
public void setAccelerate(float accelerate)
throws DOMException;
/**
* The percentage value of the simple decelerate of time for the
* element. Allowed values are from <code>0</code> to <code>100</code> .
* Default value is <code>0</code> (no deceleration).
* <br> The sum of the values for accelerate and decelerate must not exceed
* 100. If it does, the deceleration value will be reduced to make the
* sum legal.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public float getDecelerate();
public void setDecelerate(float decelerate)
throws DOMException;
/**
* The autoReverse attribute controls the "play forwards then backwards"
* functionality. Default value is <code>false</code> .
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public boolean getAutoReverse();
public void setAutoReverse(boolean autoReverse)
throws DOMException;
}
@@ -1,20 +0,0 @@
/*
* Copyright (c) 2000 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
* details.
*/
package org.w3c.dom.smil;
/**
* This interface represents the SMIL <code>animateColor</code> element.
*/
public interface SMILAnimateColorElement extends SMILAnimation {
}
@@ -1,20 +0,0 @@
/*
* Copyright (c) 2000 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
* details.
*/
package org.w3c.dom.smil;
/**
* This interface represents the SMIL <code>animate</code> element.
*/
public interface SMILAnimateElement extends SMILAnimation {
}
@@ -1,41 +0,0 @@
/*
* Copyright (c) 2000 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
* details.
*/
package org.w3c.dom.smil;
import org.w3c.dom.DOMException;
/**
* This interface present the <code>animationMotion</code> element in SMIL.
*/
public interface SMILAnimateMotionElement extends SMILAnimateElement {
/**
* Specifies the curve that describes the attribute value as a function
* of time. Check with the SVG spec for better support
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public String getPath();
public void setPath(String path)
throws DOMException;
/**
* Specifies the origin of motion for the animation.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public String getOrigin();
public void setOrigin(String origin)
throws DOMException;
}
@@ -1,124 +0,0 @@
/*
* Copyright (c) 2000 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
* details.
*/
package org.w3c.dom.smil;
import org.w3c.dom.DOMException;
/**
* This interface define the set of animation extensions for SMIL. The
* attributes will go in a XLink interface.
*/
public interface SMILAnimation extends SMILElement, ElementTargetAttributes, ElementTime, ElementTimeControl {
// additiveTypes
public static final short ADDITIVE_REPLACE = 0;
public static final short ADDITIVE_SUM = 1;
/**
* A code representing the value of the additive attribute, as defined
* above. Default value is <code>ADDITIVE_REPLACE</code> .
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public short getAdditive();
public void setAdditive(short additive)
throws DOMException;
// accumulateTypes
public static final short ACCUMULATE_NONE = 0;
public static final short ACCUMULATE_SUM = 1;
/**
* A code representing the value of the accumulate attribute, as defined
* above. Default value is <code>ACCUMULATE_NONE</code> .
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public short getAccumulate();
public void setAccumulate(short accumulate)
throws DOMException;
// calcModeTypes
public static final short CALCMODE_DISCRETE = 0;
public static final short CALCMODE_LINEAR = 1;
public static final short CALCMODE_PACED = 2;
public static final short CALCMODE_SPLINE = 3;
/**
* A code representing the value of the calcMode attribute, as defined
* above.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public short getCalcMode();
public void setCalcMode(short calcMode)
throws DOMException;
/**
* A <code>DOMString</code> representing the value of the keySplines
* attribute. Need an interface a point (x1,y1,x2,y2)
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public String getKeySplines();
public void setKeySplines(String keySplines)
throws DOMException;
/**
* A list of the time value of the keyTimes attribute.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public TimeList getKeyTimes();
public void setKeyTimes(TimeList keyTimes)
throws DOMException;
/**
* A <code>DOMString</code> representing the value of the values
* attribute.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public String getValues();
public void setValues(String values)
throws DOMException;
/**
* A <code>DOMString</code> representing the value of the from attribute.
*
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public String getFrom();
public void setFrom(String from)
throws DOMException;
/**
* A <code>DOMString</code> representing the value of the to attribute.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public String getTo();
public void setTo(String to)
throws DOMException;
/**
* A <code>DOMString</code> representing the value of the by attribute.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this attribute is readonly.
*/
public String getBy();
public void setBy(String by)
throws DOMException;
}
@@ -1,27 +0,0 @@
/*
* Copyright (c) 2000 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
* details.
*/
package org.w3c.dom.smil;
/**
* This interface represents the set element.
*/
public interface SMILSetElement extends ElementTimeControl, ElementTime, ElementTargetAttributes, SMILElement {
/**
* Specifies the value for the attribute during the duration of this
* element.
*/
public String getTo();
public void setTo(String to);
}
@@ -1,30 +0,0 @@
/*
* Copyright (c) 2000 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
* details.
*/
package org.w3c.dom.smil;
import org.w3c.dom.Element;
/**
* Defines a block of content control. See the switch element definition .
*/
public interface SMILSwitchElement extends SMILElement {
/**
* Returns the slected element at runtime. <code>null</code> if the
* selected element is not yet available.
* @return The selected <code>Element</code> for thisd <code>switch</code>
* element.
*/
public Element getSelectedElement();
}
@@ -1,21 +0,0 @@
/*
* Copyright (c) 2000 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
* details.
*/
package org.w3c.dom.smil;
/**
* Declares layout properties for the top-layout element. See the top-layout
* element definition .
*/
public interface SMILTopLayoutElement extends SMILElement, ElementLayout {
}
@@ -1,53 +0,0 @@
/*
* Copyright (c) 2000 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
* details.
*/
package org.w3c.dom.smil;
import org.w3c.dom.events.Event;
import org.w3c.dom.views.AbstractView;
/**
* The <code>TimeEvent</code> interface provides specific contextual
* information associated with Time events.
*/
public interface TimeEvent extends Event {
/**
* The <code>view</code> attribute identifies the
* <code>AbstractView</code> from which the event was generated.
*/
public AbstractView getView();
/**
* Specifies some detail information about the <code>Event</code> ,
* depending on the type of event.
*/
public int getDetail();
/**
* The <code>initTimeEvent</code> method is used to initialize the value
* of a <code>TimeEvent</code> created through the
* <code>DocumentEvent</code> interface. This method may only be called
* before the <code>TimeEvent</code> has been dispatched via the
* <code>dispatchEvent</code> method, though it may be called multiple
* times during that phase if necessary. If called multiple times, the
* final invocation takes precedence.
* @param typeArg Specifies the event type.
* @param viewArg Specifies the <code>Event</code> 's
* <code>AbstractView</code> .
* @param detailArg Specifies the <code>Event</code> 's detail.
*/
public void initTimeEvent(String typeArg,
AbstractView viewArg,
int detailArg);
}
@@ -1,27 +0,0 @@
/*
* Copyright (c) 2000 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE.
* See W3C License http://www.w3.org/Consortium/Legal/ for more details.
*/
package org.w3c.dom.views;
/**
* A base interface that all views shall derive from.
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Views-20001113'>Document Object Model (DOM) Level 2 Views Specification</a>.
* @since DOM Level 2
*/
public interface AbstractView {
/**
* The source <code>DocumentView</code> of which this is an
* <code>AbstractView</code>.
*/
public DocumentView getDocument();
}
@@ -1,30 +0,0 @@
/*
* Copyright (c) 2000 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE.
* See W3C License http://www.w3.org/Consortium/Legal/ for more details.
*/
package org.w3c.dom.views;
/**
* The <code>DocumentView</code> interface is implemented by
* <code>Document</code> objects in DOM implementations supporting DOM
* Views. It provides an attribute to retrieve the default view of a
* document.
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Views-20001113'>Document Object Model (DOM) Level 2 Views Specification</a>.
* @since DOM Level 2
*/
public interface DocumentView {
/**
* The default <code>AbstractView</code> for this <code>Document</code>,
* or <code>null</code> if none available.
*/
public AbstractView getDefaultView();
}