1/*
2 * Copyright (C) 2011 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
17package com.android.gallery3d.app;
18
19
20import android.app.Activity;
21import android.content.ActivityNotFoundException;
22import android.content.Intent;
23import android.os.Bundle;
24import android.util.Log;
25
26/* This Activity does nothing but receive USB_DEVICE_ATTACHED events from the
27 * USB service and springboards to the main Gallery activity
28 */
29public final class UsbDeviceActivity extends Activity {
30
31    static final String TAG = "UsbDeviceActivity";
32
33    @Override
34    protected void onCreate(Bundle savedInstanceState) {
35        super.onCreate(savedInstanceState);
36
37        //
38        Intent intent = new Intent(this, Gallery.class);
39        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
40        try {
41            startActivity(intent);
42        } catch (ActivityNotFoundException e) {
43            Log.e(TAG, "unable to start Gallery activity", e);
44        }
45        finish();
46    }
47}
48