1/*
2 * Copyright (C) 2010 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.deskclock.tests;
18
19import android.app.Activity;
20import android.content.Intent;
21import android.os.Bundle;
22import android.provider.AlarmClock;
23
24public class TestAddAlarm extends Activity {
25
26    @Override
27    protected void onCreate(Bundle icicle) {
28        super.onCreate(icicle);
29
30        Intent i = new Intent(AlarmClock.ACTION_SET_ALARM);
31        i.putExtra(AlarmClock.EXTRA_MESSAGE, "New Alarm!");
32        i.putExtra(AlarmClock.EXTRA_HOUR, 12);
33        i.putExtra(AlarmClock.EXTRA_MINUTES, 27);
34        i.putExtra(AlarmClock.EXTRA_SKIP_UI, true);
35
36        startActivity(i);
37
38        // Should not see a duplicate
39        startActivity(i);
40
41        i.removeExtra(AlarmClock.EXTRA_MESSAGE);
42        startActivity(i);
43        // No dup of null message.
44        startActivity(i);
45
46        // Launch with SetAlarm UI.
47        i.putExtra(AlarmClock.EXTRA_SKIP_UI, false);
48        startActivity(i);
49
50        finish();
51    }
52}
53