136612d27b67ff2e79ffff8eb12d95d2058abde02Jeff Sharkey/*
236612d27b67ff2e79ffff8eb12d95d2058abde02Jeff Sharkey * Copyright (C) 2008 The Android Open Source Project
336612d27b67ff2e79ffff8eb12d95d2058abde02Jeff Sharkey *
436612d27b67ff2e79ffff8eb12d95d2058abde02Jeff Sharkey * Licensed under the Apache License, Version 2.0 (the "License");
536612d27b67ff2e79ffff8eb12d95d2058abde02Jeff Sharkey * you may not use this file except in compliance with the License.
636612d27b67ff2e79ffff8eb12d95d2058abde02Jeff Sharkey * You may obtain a copy of the License at
736612d27b67ff2e79ffff8eb12d95d2058abde02Jeff Sharkey *
836612d27b67ff2e79ffff8eb12d95d2058abde02Jeff Sharkey *      http://www.apache.org/licenses/LICENSE-2.0
936612d27b67ff2e79ffff8eb12d95d2058abde02Jeff Sharkey *
1036612d27b67ff2e79ffff8eb12d95d2058abde02Jeff Sharkey * Unless required by applicable law or agreed to in writing, software
1136612d27b67ff2e79ffff8eb12d95d2058abde02Jeff Sharkey * distributed under the License is distributed on an "AS IS" BASIS,
1236612d27b67ff2e79ffff8eb12d95d2058abde02Jeff Sharkey * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1336612d27b67ff2e79ffff8eb12d95d2058abde02Jeff Sharkey * See the License for the specific language governing permissions and
1436612d27b67ff2e79ffff8eb12d95d2058abde02Jeff Sharkey * limitations under the License.
1536612d27b67ff2e79ffff8eb12d95d2058abde02Jeff Sharkey */
1623357198c440e6872d3aef3e608295db7f8273bcSteve Howard
1723357198c440e6872d3aef3e608295db7f8273bcSteve Howardpackage com.android.providers.downloads;
1823357198c440e6872d3aef3e608295db7f8273bcSteve Howard
190a77c62a82503b38c484e0079648f0231dd85d53Steve Howardimport android.content.Intent;
200a77c62a82503b38c484e0079648f0231dd85d53Steve Howardimport android.content.pm.PackageManager.NameNotFoundException;
21961024389b3782936a40a7d090d670290bb66c3cJeff Sharkeyimport android.net.NetworkInfo;
220a77c62a82503b38c484e0079648f0231dd85d53Steve Howard
2323357198c440e6872d3aef3e608295db7f8273bcSteve Howardinterface SystemFacade {
24af28400b74de05862b470412a5c92f68e99f59f8Steve Howard    /**
25af28400b74de05862b470412a5c92f68e99f59f8Steve Howard     * @see System#currentTimeMillis()
26af28400b74de05862b470412a5c92f68e99f59f8Steve Howard     */
2723357198c440e6872d3aef3e608295db7f8273bcSteve Howard    public long currentTimeMillis();
28af28400b74de05862b470412a5c92f68e99f59f8Steve Howard
29af28400b74de05862b470412a5c92f68e99f59f8Steve Howard    /**
30961024389b3782936a40a7d090d670290bb66c3cJeff Sharkey     * @return Currently active network, or null if there's no active
31961024389b3782936a40a7d090d670290bb66c3cJeff Sharkey     *         connection.
32af28400b74de05862b470412a5c92f68e99f59f8Steve Howard     */
33961024389b3782936a40a7d090d670290bb66c3cJeff Sharkey    public NetworkInfo getActiveNetworkInfo(int uid);
34af28400b74de05862b470412a5c92f68e99f59f8Steve Howard
35a7ae77fdae69bcc6d6609d4639fed5d96e55eeaaJeff Sharkey    public boolean isActiveNetworkMetered();
36a7ae77fdae69bcc6d6609d4639fed5d96e55eeaaJeff Sharkey
37af28400b74de05862b470412a5c92f68e99f59f8Steve Howard    /**
38af28400b74de05862b470412a5c92f68e99f59f8Steve Howard     * @see android.telephony.TelephonyManager#isNetworkRoaming
39af28400b74de05862b470412a5c92f68e99f59f8Steve Howard     */
40af28400b74de05862b470412a5c92f68e99f59f8Steve Howard    public boolean isNetworkRoaming();
41071bd7acb3185f4f1e807855605c5e6018e9742fSteve Howard
42071bd7acb3185f4f1e807855605c5e6018e9742fSteve Howard    /**
43071bd7acb3185f4f1e807855605c5e6018e9742fSteve Howard     * @return maximum size, in bytes, of downloads that may go over a mobile connection; or null if
44071bd7acb3185f4f1e807855605c5e6018e9742fSteve Howard     * there's no limit
45071bd7acb3185f4f1e807855605c5e6018e9742fSteve Howard     */
460d4f9f105c3a31475a36e9a1edfa868c66ff455fSteve Howard    public Long getMaxBytesOverMobile();
470a77c62a82503b38c484e0079648f0231dd85d53Steve Howard
480a77c62a82503b38c484e0079648f0231dd85d53Steve Howard    /**
49d319729622da1893e895f2e35f41d01ecdca3705Steve Howard     * @return recommended maximum size, in bytes, of downloads that may go over a mobile
50d319729622da1893e895f2e35f41d01ecdca3705Steve Howard     * connection; or null if there's no recommended limit.  The user will have the option to bypass
51d319729622da1893e895f2e35f41d01ecdca3705Steve Howard     * this limit.
52d319729622da1893e895f2e35f41d01ecdca3705Steve Howard     */
53d319729622da1893e895f2e35f41d01ecdca3705Steve Howard    public Long getRecommendedMaxBytesOverMobile();
54d319729622da1893e895f2e35f41d01ecdca3705Steve Howard
55d319729622da1893e895f2e35f41d01ecdca3705Steve Howard    /**
560a77c62a82503b38c484e0079648f0231dd85d53Steve Howard     * Send a broadcast intent.
570a77c62a82503b38c484e0079648f0231dd85d53Steve Howard     */
580a77c62a82503b38c484e0079648f0231dd85d53Steve Howard    public void sendBroadcast(Intent intent);
590a77c62a82503b38c484e0079648f0231dd85d53Steve Howard
600a77c62a82503b38c484e0079648f0231dd85d53Steve Howard    /**
610a77c62a82503b38c484e0079648f0231dd85d53Steve Howard     * Returns true if the specified UID owns the specified package name.
620a77c62a82503b38c484e0079648f0231dd85d53Steve Howard     */
630a77c62a82503b38c484e0079648f0231dd85d53Steve Howard    public boolean userOwnsPackage(int uid, String pckg) throws NameNotFoundException;
6423357198c440e6872d3aef3e608295db7f8273bcSteve Howard}
65