Home | History | Annotate | Download | only in embmsdownload
      1 /*
      2  * Copyright (C) 2017 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License
     15  */
     16 
     17 package com.android.phone.testapps.embmsdownload;
     18 
     19 import android.content.ComponentName;
     20 import android.content.Context;
     21 import android.content.Intent;
     22 import android.telephony.mbms.FileServiceInfo;
     23 
     24 public class SideChannel {
     25     public static final String ACTION_TRIGGER_CLEANUP =
     26             "com.android.phone.testapps.embmsmw.TRIGGER_CLEANUP";
     27     public static final String ACTION_REQUEST_SPURIOUS_TEMP_FILES =
     28             "com.android.phone.testapps.embmsmw.REQUEST_SPURIOUS_TEMP_FILES";
     29     public static final String ACTION_DELAY_DOWNLOAD =
     30             "com.android.phone.testapps.embmsmw.DELAY_DOWNLOAD";
     31 
     32     public static final String EXTRA_SERVICE_INFO =
     33             "com.android.phone.testapps.embmsmw.SERVICE_INFO";
     34     public static final String EXTRA_DELAY_FACTOR =
     35             "com.android.phone.testapps.embmsmw.DELAY_FACTOR";
     36 
     37     public static final ComponentName MIDDLEWARE_RECEIVER = new ComponentName(
     38             "com.android.phone.testapps.embmsmw",
     39             "com.android.phone.testapps.embmsmw.SideChannelReceiver");
     40 
     41     public static void triggerCleanup(Context context) {
     42         Intent intent  = new Intent(ACTION_TRIGGER_CLEANUP);
     43         intent.setComponent(MIDDLEWARE_RECEIVER);
     44         context.sendBroadcast(intent);
     45     }
     46 
     47     public static void requestSpuriousTempFiles(Context context, FileServiceInfo serviceInfo) {
     48         Intent intent = new Intent(ACTION_REQUEST_SPURIOUS_TEMP_FILES);
     49         intent.putExtra(EXTRA_SERVICE_INFO, serviceInfo);
     50         intent.setComponent(MIDDLEWARE_RECEIVER);
     51         context.sendBroadcast(intent);
     52     }
     53 
     54     public static void delayDownloads(Context context, int delay) {
     55         Intent intent = new Intent(ACTION_DELAY_DOWNLOAD);
     56         intent.putExtra(EXTRA_DELAY_FACTOR, delay);
     57         intent.setComponent(MIDDLEWARE_RECEIVER);
     58         context.sendBroadcast(intent);
     59     }
     60 }
     61