Snap for 4455664 from 47aded5406f2ff6cc1cb49b2cca2637fe8a649b2 to oreo-vts-release

Change-Id: If1b1f3f503a1770b51cdf2fac4cd80ce2ccd5aca
diff --git a/Common/src/com/googlecode/android_scripting/facade/ApplicationManagerFacade.java b/Common/src/com/googlecode/android_scripting/facade/ApplicationManagerFacade.java
index e8207c7..1292fe5 100644
--- a/Common/src/com/googlecode/android_scripting/facade/ApplicationManagerFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/ApplicationManagerFacade.java
@@ -76,14 +76,6 @@
     mAndroidFacade.startActivity(intent);
   }
 
-  @Rpc(description = "Start activity with the given class name with result")
-  public Intent launchForResult(@RpcParameter(name = "className") String className) {
-    Intent intent = new Intent(Intent.ACTION_MAIN);
-    String packageName = className.substring(0, className.lastIndexOf("."));
-    intent.setClassName(packageName, className);
-    return mAndroidFacade.startActivityForResult(intent);
-  }
-
   @Rpc(description = "Launch the specified app.")
   public void appLaunch(@RpcParameter(name = "name") String name) {
       Intent LaunchIntent = mPackageManager.getLaunchIntentForPackage(name);
diff --git a/Common/src/com/googlecode/android_scripting/facade/ConnectivityManagerFacade.java b/Common/src/com/googlecode/android_scripting/facade/ConnectivityManagerFacade.java
index 5492364..a559aad 100644
--- a/Common/src/com/googlecode/android_scripting/facade/ConnectivityManagerFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/ConnectivityManagerFacade.java
@@ -17,8 +17,6 @@
 package com.googlecode.android_scripting.facade;
 
 import android.app.Service;
-import android.app.usage.NetworkStats.Bucket;
-import android.app.usage.NetworkStatsManager;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
@@ -30,13 +28,11 @@
 import android.net.Network;
 import android.net.NetworkCapabilities;
 import android.net.NetworkInfo;
-import android.net.NetworkPolicy;
-import android.net.NetworkPolicyManager;
 import android.net.NetworkRequest;
 import android.net.StringNetworkSpecifier;
 import android.os.Bundle;
-import android.os.RemoteException;
 import android.provider.Settings;
+
 import com.googlecode.android_scripting.Log;
 import com.googlecode.android_scripting.facade.wifi.WifiAwareManagerFacade;
 import com.googlecode.android_scripting.jsonrpc.RpcReceiver;
@@ -48,17 +44,13 @@
 import org.json.JSONException;
 import org.json.JSONObject;
 
-import java.net.Inet4Address;
 import java.net.Inet6Address;
 import java.net.InetAddress;
 import java.net.NetworkInterface;
 import java.net.SocketException;
 import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.List;
 
 /**
  * Access ConnectivityManager functions.
@@ -413,8 +405,6 @@
     }
 
     private final ConnectivityManager mManager;
-    private NetworkPolicyManager mNetPolicyManager;
-    private NetworkStatsManager mNetStatsManager;
     private final Service mService;
     private final Context mContext;
     private final ConnectivityReceiver mConnectivityReceiver;
@@ -432,9 +422,6 @@
         mService = manager.getService();
         mContext = mService.getBaseContext();
         mManager = (ConnectivityManager) mService.getSystemService(Context.CONNECTIVITY_SERVICE);
-        mNetPolicyManager = NetworkPolicyManager.from(mContext);
-        mNetStatsManager = (NetworkStatsManager)
-              mService.getSystemService(Context.NETWORK_STATS_SERVICE);
         mEventFacade = manager.getReceiver(EventFacade.class);
         mConnectivityReceiver = new ConnectivityReceiver();
         mTrackingConnectivityStateChange = false;
@@ -801,7 +788,9 @@
         mManager.stopTethering(type);
     }
 
-    private Enumeration<InetAddress> getInetAddrsForInterface(String ifaceName) {
+    @Rpc(description = "Returns the link local IPv6 address of the interface.")
+    public String connectivityGetLinkLocalIpv6Address(@RpcParameter(name = "ifaceName")
+            String ifaceName) {
         NetworkInterface iface = null;
         try {
             iface = NetworkInterface.getByName(ifaceName);
@@ -809,20 +798,12 @@
             return null;
         }
 
-        if (iface == null)
-            return null;
-        return iface.getInetAddresses();
-    }
-
-    @Rpc(description = "Returns the link local IPv6 address of the interface.")
-    public String connectivityGetLinkLocalIpv6Address(@RpcParameter(name = "ifaceName")
-            String ifaceName) {
-        Inet6Address inet6Address = null;
-        Enumeration<InetAddress> inetAddresses = getInetAddrsForInterface(ifaceName);
-        if (inetAddresses == null) {
+        if (iface == null) {
             return null;
         }
 
+        Inet6Address inet6Address = null;
+        Enumeration<InetAddress> inetAddresses = iface.getInetAddresses();
         while (inetAddresses.hasMoreElements()) {
             InetAddress addr = inetAddresses.nextElement();
             if (addr instanceof Inet6Address) {
@@ -840,103 +821,11 @@
         return inet6Address.getHostAddress();
     }
 
-    @Rpc(description = "Return IPv4 address of an interface")
-    public List<String> connectivityGetIPv4Addresses(
-            @RpcParameter(name = "ifaceName") String ifaceName) {
-        Enumeration<InetAddress> inetAddresses
-                = getInetAddrsForInterface(ifaceName);
-        if (inetAddresses == null)
-            return null;
-
-        List<String> inetAddrs = new ArrayList<String>();
-        while (inetAddresses.hasMoreElements()) {
-            InetAddress addr = inetAddresses.nextElement();
-            if (addr instanceof Inet4Address) {
-                Inet4Address inet4Address =  (Inet4Address) addr;
-                inetAddrs.add(inet4Address.getHostAddress());
-            }
-        }
-
-        return inetAddrs;
-    }
-
-    @Rpc(description = "Return IPv6 addrs of an interface except link local")
-    public List<String> connectivityGetIPv6Addresses(
-            @RpcParameter(name = "ifaceName") String ifaceName) {
-        Enumeration<InetAddress> inetAddresses
-                = getInetAddrsForInterface(ifaceName);
-        if (inetAddresses == null)
-            return null;
-
-        List<String> inetAddrs = new ArrayList<String>();
-        while (inetAddresses.hasMoreElements()) {
-            InetAddress addr = inetAddresses.nextElement();
-            if (addr instanceof Inet6Address) {
-                if (((Inet6Address) addr).isLinkLocalAddress())
-                    continue;
-                Inet6Address inet6Address =  (Inet6Address) addr;
-                inetAddrs.add(inet6Address.getHostAddress());
-            }
-        }
-
-        return inetAddrs;
-    }
-
     @Rpc(description = "Returns active link properties")
     public LinkProperties connectivityGetActiveLinkProperties() {
         return mManager.getActiveLinkProperties();
     }
 
-    @Rpc(description = "Factory reset of network policies")
-    public void connectivityFactoryResetNetworkPolicies(String subscriberId) {
-        mNetPolicyManager.factoryReset(subscriberId);
-    }
-
-    @Rpc(description = "Set data usage limit for subscription ID")
-    public void connectivitySetDataUsageLimit(
-          String subscriberId, String dataLimit) {
-        NetworkPolicy[] allPolicies = mNetPolicyManager.getNetworkPolicies();
-        for(int i=0; i<allPolicies.length; i++) {
-            String subId = allPolicies[i].template.getSubscriberId();
-            if(subId!=null && subId.equals(subscriberId)) {
-                allPolicies[i].limitBytes = Long.valueOf(dataLimit);
-                break;
-            }
-        }
-        mNetPolicyManager.setNetworkPolicies(allPolicies);
-    }
-
-    @Rpc(description = "Get network stats for device")
-    public long connectivityQuerySummaryForDevice(
-          String subscriberId, Long startTime, Long endTime)
-          throws SecurityException, RemoteException {
-        Bucket bucket = mNetStatsManager.querySummaryForDevice(
-              ConnectivityManager.TYPE_MOBILE, subscriberId, startTime, endTime);
-        return bucket.getTxBytes() + bucket.getRxBytes();
-    }
-
-    @Rpc(description = "Get network stats - received bytes for device")
-    public long connectivityGetRxBytesForDevice(
-          String subscriberId, Long startTime, Long endTime)
-          throws SecurityException, RemoteException {
-        Bucket bucket = mNetStatsManager.querySummaryForDevice(
-              ConnectivityManager.TYPE_MOBILE, subscriberId, startTime, endTime);
-        return bucket.getRxBytes();
-    }
-
-    @Rpc(description = "Returns all interfaces on the android deivce")
-    public List<NetworkInterface> connectivityGetNetworkInterfaces() {
-        List<NetworkInterface> interfaces = null;
-        try {
-            interfaces = Collections.list(
-                  NetworkInterface.getNetworkInterfaces());
-        } catch (SocketException e) {
-            return null;
-        };
-
-        return interfaces;
-    }
-
     @Override
     public void shutdown() {
         connectivityStopTrackingConnectivityStateChange();
diff --git a/Common/src/com/googlecode/android_scripting/facade/telephony/TelephonyManagerFacade.java b/Common/src/com/googlecode/android_scripting/facade/telephony/TelephonyManagerFacade.java
index 4c113f1..07d5fbb 100644
--- a/Common/src/com/googlecode/android_scripting/facade/telephony/TelephonyManagerFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/telephony/TelephonyManagerFacade.java
@@ -789,17 +789,6 @@
         return mTelephonyManager.supplyPuk(puk, pin);
     }
 
-    /**
-    * Supply pin for locked SIM.
-    * @param pin the puk pin string
-    * @return    true or false for supplying the pin successfully or unsuccessfully.
-    */
-    @Rpc(description = "Supply Pin for locked SIM.")
-    public boolean telephonySupplyPin(
-            @RpcParameter(name = "pin") String pin) {
-        return mTelephonyManager.supplyPin(pin);
-    }
-
     @Rpc(description = "Returns the unique subscriber ID (such as IMSI) " +
             "for default subscription ID, or null if unavailable")
     public String telephonyGetSubscriberId() {