| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.service.carrier; |
| 18 |
|
| 19 |
import android.annotation.NonNull; |
| 20 |
import android.annotation.Nullable; |
| 21 |
import android.annotation.SystemApi; |
| 22 |
import android.annotation.WorkerThread; |
| 23 |
import android.app.Service; |
| 24 |
import android.content.ContentValues; |
| 25 |
import android.content.Intent; |
| 26 |
import android.os.IBinder; |
| 27 |
import android.util.Log; |
| 28 |
|
| 29 |
import android.service.carrier.IApnSourceService; |
| 30 |
|
| 31 |
import java.util.List; |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
@SystemApi |
| 44 |
public abstract class ApnService extends Service { |
| 45 |
|
| 46 |
private static final String LOG_TAG = "ApnService"; |
| 47 |
|
| 48 |
private final IApnSourceService.Stub mBinder = new IApnSourceService.Stub() { |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
@Override |
| 53 |
public ContentValues[] getApns(int subId) { |
| 54 |
try { |
| 55 |
List<ContentValues> apns = ApnService.this.onRestoreApns(subId); |
| 56 |
return apns.toArray(new ContentValues[apns.size()]); |
| 57 |
} catch (Exception e) { |
| 58 |
Log.e(LOG_TAG, "Error in getApns for subId=" + subId + ": " + e.getMessage(), e); |
| 59 |
return null; |
| 60 |
} |
| 61 |
} |
| 62 |
}; |
| 63 |
|
| 64 |
@Override |
| 65 |
@NonNull |
| 66 |
public IBinder onBind(@Nullable Intent intent) { |
| 67 |
return mBinder; |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
@WorkerThread |
| 79 |
@NonNull |
| 80 |
public abstract List<ContentValues> onRestoreApns(int subId); |
| 81 |
} |