gui: Adding Face list/create/destroy operations

Change-Id: Ic27f110bb31048048136c76bfb243f56405218d1
Refs: #2430
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3b4f4bf..f8ebe5b 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -28,6 +28,10 @@
             android:name=".LogcatActivity"
             android:label="@string/nfd_logger" />
 
+        <activity
+            android:name=".FaceListActivity"
+            android:label="Faces" />
+
         <service
             android:name=".service.NfdService"
             android:process="net.named_data.nfd.service.NfdService"
diff --git a/app/src/main/java/net/named_data/nfd/FaceCreateDialog.java b/app/src/main/java/net/named_data/nfd/FaceCreateDialog.java
new file mode 100644
index 0000000..0020f59
--- /dev/null
+++ b/app/src/main/java/net/named_data/nfd/FaceCreateDialog.java
@@ -0,0 +1,84 @@
+/* -*- Mode:jde; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2015 Regents of the University of California
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon) Android.
+ * See AUTHORS.md for complete list of NFD Android authors and contributors.
+ *
+ * NFD Android is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD Android is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD Android, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package net.named_data.nfd;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.WindowManager;
+import android.widget.EditText;
+
+import net.named_data.jndn_xx.util.FaceUri;
+import net.named_data.nfd.utils.Nfdc;
+import net.named_data.nfd.utils.NfdcAsyncTask;
+
+public class FaceCreateDialog extends DialogFragment
+{
+  @Override
+  public Dialog
+  onCreateDialog(Bundle savedInstanceState) {
+    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+    LayoutInflater inflater = getActivity().getLayoutInflater();
+    builder
+      .setView(inflater.inflate(R.layout.create_face, null))
+      .setPositiveButton("Create face", new DialogInterface.OnClickListener() {
+          @Override
+          public void onClick(DialogInterface dialog, int id)
+          {
+            EditText uriBox = (EditText) getDialog().findViewById(R.id.faceUri);
+            final String uri = uriBox.getText().toString();
+            new NfdcAsyncTask(getActivity(),
+                              new NfdcAsyncTask.Task() {
+                                public String
+                                runTask() throws Exception
+                                {
+                                  try {
+                                    Nfdc nfdc = new Nfdc();
+                                    int faceId = nfdc.faceCreate(m_uri);
+                                    nfdc.shutdown();
+                                    return "OK. Face id: " + String.valueOf(faceId);
+                                  } catch (FaceUri.CanonizeError e) {
+                                    return "Error creating face (" + e.getMessage() + ")";
+                                  } catch (FaceUri.Error e) {
+                                    return "Error creating face (" + e.getMessage() + ")";
+                                  }
+                                }
+
+                                ///////////////////////////
+                                private String m_uri = uri;
+                              }).execute();
+          }
+        })
+      .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
+          public void onClick(DialogInterface dialog, int id)
+          {
+            FaceCreateDialog.this.getDialog().cancel();
+          }
+        })
+    ;
+
+    Dialog faceCreateDialog = builder.create();
+    faceCreateDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
+    return faceCreateDialog;
+  }
+}
diff --git a/app/src/main/java/net/named_data/nfd/FaceListActivity.java b/app/src/main/java/net/named_data/nfd/FaceListActivity.java
new file mode 100644
index 0000000..50b5155
--- /dev/null
+++ b/app/src/main/java/net/named_data/nfd/FaceListActivity.java
@@ -0,0 +1,282 @@
+/* -*- Mode:jde; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2015 Regents of the University of California
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon) Android.
+ * See AUTHORS.md for complete list of NFD Android authors and contributors.
+ *
+ * NFD Android is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD Android is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD Android, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package net.named_data.nfd;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.FragmentManager;
+import android.app.FragmentTransaction;
+import android.app.ListFragment;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.BaseAdapter;
+import android.widget.TextView;
+
+import com.intel.jndn.management.types.FacePersistency;
+import com.intel.jndn.management.types.FaceScope;
+import com.intel.jndn.management.types.FaceStatus;
+
+import net.named_data.nfd.utils.NfdcAsyncTask;
+import net.named_data.nfd.utils.Nfdc;
+
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormat;
+
+import java.util.List;
+
+public class FaceListActivity extends Activity
+{
+  @Override
+  public void
+  onCreate(Bundle savedInstanceState)
+  {
+    super.onCreate(savedInstanceState);
+
+    FragmentManager fm = getFragmentManager();
+    FragmentTransaction ft = fm.beginTransaction();
+    if (fm.findFragmentById(android.R.id.content) == null) {
+      ft.add(android.R.id.content, m_faceListFragment);
+    }
+    else {
+      ft.replace(android.R.id.content, m_faceListFragment);
+    }
+    ft.commit();
+  }
+
+  public static class FaceListFragment extends ListFragment {
+    @Override
+    public void onActivityCreated(Bundle savedInstanceState)
+    {
+      super.onActivityCreated(savedInstanceState);
+
+      setListAdapter(new FaceListAdapter(getActivity()));
+      getListView().setLongClickable(true);
+
+      getListView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener()
+      {
+        @Override
+        public boolean onItemLongClick(final AdapterView<?> parent, View view, final int position, long id)
+        {
+          final int faceId = (int)id;
+
+          AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());
+          alertDialogBuilder
+            .setMessage("Delete face " + String.valueOf(faceId) + "?")
+            .setCancelable(false)
+            .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
+              public void onClick(DialogInterface dialog,int id) {
+                new NfdcAsyncTask(getActivity(),
+                                  new NfdcAsyncTask.Task() {
+                                    public String
+                                    runTask() throws Exception
+                                    {
+                                      Nfdc nfdc = new Nfdc();
+                                      nfdc.faceDestroy(faceId);
+                                      nfdc.shutdown();
+
+                                      getActivity().runOnUiThread(new Runnable() {
+                                        @Override
+                                        public void run()
+                                        {
+                                          ((FaceListAdapter) parent.getAdapter()).updateFaceList();
+                                        }
+                                      });
+                                      return null;
+                                    }
+                                  }).execute();
+              }
+            })
+            .setNegativeButton("No", new DialogInterface.OnClickListener() {
+              public void onClick(DialogInterface dialog,int id) {
+                dialog.cancel();
+              }
+            });
+
+          AlertDialog alertDialog = alertDialogBuilder.create();
+          alertDialog.show();
+
+          return true;
+        }
+      });
+    }
+
+    private class FaceListAdapter extends BaseAdapter
+    {
+      public FaceListAdapter(Context context)
+      {
+        this.m_inflater = LayoutInflater.from(context);
+        this.m_context = context;
+
+        updateFaceList();
+      }
+
+      public void
+      updateFaceList()
+      {
+        new NfdcAsyncTask(m_context,
+                          new NfdcAsyncTask.Task() {
+                            public String
+                            runTask() throws Exception
+                            {
+                              synchronized (m_facesLock) {
+                                Nfdc nfdc = new Nfdc();
+                                m_faces = nfdc.faceList();
+                                nfdc.shutdown();
+                              }
+
+                              getActivity().runOnUiThread(new Runnable() {
+                                @Override
+                                public void run()
+                                {
+                                  notifyDataSetChanged();
+                                }
+                              });
+                              return null;
+                            }
+                          }).execute();
+      }
+
+      @Override
+      public int
+      getCount()
+      {
+        synchronized (m_facesLock) {
+          if (m_faces == null)
+            return 0;
+          else
+            return m_faces.size();
+        }
+      }
+
+      @Override
+      public Object
+      getItem(int position)
+      {
+        synchronized (m_facesLock) {
+          assert m_faces != null && position < m_faces.size();
+          return m_faces.get(position);
+        }
+      }
+
+      @Override
+      public long
+      getItemId(int position)
+      {
+        synchronized (m_facesLock) {
+          assert m_faces != null && position < m_faces.size();
+          return m_faces.get(position).getFaceId();
+        }
+      }
+
+      @Override
+      public View
+      getView(int position, View convertView, ViewGroup parent)
+      {
+        FaceListItemViewHolder holder;
+        if (convertView == null) {
+          convertView = this.m_inflater.inflate(R.layout.face_list_item, parent, false);
+          holder = new FaceListItemViewHolder(convertView);
+          convertView.setTag(holder);
+        } else {
+          holder = (FaceListItemViewHolder) convertView.getTag();
+        }
+
+        FaceStatus s;
+        synchronized (m_facesLock) {
+          s = m_faces.get(position);
+        }
+        holder.localUri.setText(s.getLocalUri());
+        if (!s.getLocalUri().equals(s.getUri())) {
+          holder.remoteUri.setVisibility(View.VISIBLE);
+          holder.remoteUri.setText(s.getUri());
+        }
+        else {
+          holder.remoteUri.setVisibility(View.GONE);
+        }
+        holder.faceId.setText(String.valueOf(s.getFaceId()));
+        holder.scope.setText(getScope(s.getFaceScope()));
+        holder.persistency.setText(getPersistency(s.getFacePersistency()));
+        if (s.getExpirationPeriod() > 0) {
+          holder.expires.setVisibility(View.VISIBLE);
+          holder.expires.setText("expires in " + PeriodFormat.getDefault().print(new Period(s.getExpirationPeriod())));
+        }
+        else {
+          holder.expires.setVisibility(View.GONE);
+        }
+
+        return convertView;
+      }
+
+      /////////////////////////////////////////////////////////////////////////
+      private LayoutInflater m_inflater;
+      private Context m_context;
+      private List<FaceStatus> m_faces;
+      private final Object m_facesLock = new Object();
+
+    }
+
+    private static class FaceListItemViewHolder {
+      FaceListItemViewHolder(View v)
+      {
+        localUri = (TextView)v.findViewById(R.id.localUri);
+        remoteUri = (TextView)v.findViewById(R.id.remoteUri);
+        faceId = (TextView)v.findViewById(R.id.faceId);
+        scope = (TextView)v.findViewById(R.id.scope);
+        persistency = (TextView)v.findViewById(R.id.persistency);
+        expires = (TextView)v.findViewById(R.id.expires);
+      }
+
+      /////////////////////////////////////////////////////////////////////////
+      public TextView localUri;
+      public TextView remoteUri;
+      public TextView faceId;
+      public TextView scope;
+      public TextView persistency;
+      public TextView expires;
+    }
+  }
+
+  ////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private static String
+  getScope(FaceScope scope)
+  {
+    assert scope.getNumericValue() < s_scopes.length;
+    return s_scopes[scope.getNumericValue()];
+  }
+
+  private static String
+  getPersistency(FacePersistency persistency)
+  {
+    assert persistency.getNumericValue() < s_persistencies.length;
+    return s_persistencies[persistency.getNumericValue()];
+  }
+
+
+  private static final String[] s_scopes = {"Local", "Non-local"};
+  private static final String[] s_persistencies = {"Persistent", "On-demand", "Permanent"};
+
+  private FaceListFragment m_faceListFragment = new FaceListFragment();
+}
diff --git a/app/src/main/java/net/named_data/nfd/MainActivity.java b/app/src/main/java/net/named_data/nfd/MainActivity.java
index 9bbf5eb..883bef1 100644
--- a/app/src/main/java/net/named_data/nfd/MainActivity.java
+++ b/app/src/main/java/net/named_data/nfd/MainActivity.java
@@ -19,6 +19,7 @@
 
 package net.named_data.nfd;
 
+import android.app.DialogFragment;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -52,32 +53,44 @@
         public void onCreate(Bundle savedInstanceState)
         {
           super.onCreate(savedInstanceState);
+
+          ///////////////////////////////////////////////////////////////////////////
+          // General settings
+          ///////////////////////////////////////////////////////////////////////////
           addPreferencesFromResource(R.xml.pref_general);
 
           m_startStopPref = findPreference("start_stop");
+          m_startStopPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener()
+          {
+            @Override
+            public boolean onPreferenceClick(Preference preference)
+            {
+              toggleNfdState();
+              return true;
+            }
+          });
+
+          ///////////////////////////////////////////////////////////////////////////
+          // Face settings
+          ///////////////////////////////////////////////////////////////////////////
+          addPreferencesFromResource(R.xml.pref_face);
+
+          findPreference("create_face")
+            .setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+              @Override
+              public boolean onPreferenceClick(Preference preference)
+              {
+                DialogFragment dialog = new FaceCreateDialog();
+                dialog.show(getFragmentManager(), "FaceCreateFragment");
+                return true;
+              }
+            });
         }
       })
       .commit();
   }
 
   @Override
-  protected void
-  onPostCreate(Bundle savedInstanceState)
-  {
-    super.onPostCreate(savedInstanceState);
-
-    m_startStopPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener()
-    {
-      @Override
-      public boolean onPreferenceClick(Preference preference)
-      {
-        toggleNfdState();
-        return true;
-      }
-    });
-  }
-
-  @Override
   protected void onResume() {
     super.onResume();
 
diff --git a/app/src/main/java/net/named_data/nfd/utils/Nfdc.java b/app/src/main/java/net/named_data/nfd/utils/Nfdc.java
new file mode 100644
index 0000000..a266ef2
--- /dev/null
+++ b/app/src/main/java/net/named_data/nfd/utils/Nfdc.java
@@ -0,0 +1,275 @@
+/* -*- Mode:jde; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2015 Regents of the University of California
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon) Android.
+ * See AUTHORS.md for complete list of NFD Android authors and contributors.
+ *
+ * NFD Android is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD Android is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD Android, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package net.named_data.nfd.utils;
+
+import com.intel.jndn.management.NFD;
+import com.intel.jndn.management.types.FaceStatus;
+
+import net.named_data.jndn.Face;
+import net.named_data.jndn.Name;
+import net.named_data.jndn.security.*;
+import net.named_data.jndn.security.identity.IdentityManager;
+import net.named_data.jndn.security.identity.MemoryIdentityStorage;
+import net.named_data.jndn.security.identity.MemoryPrivateKeyStorage;
+import net.named_data.jndn.security.policy.SelfVerifyPolicyManager;
+import net.named_data.jndn.util.Blob;
+import net.named_data.jndn_xx.util.FaceUri;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+
+public class Nfdc
+{
+  public Nfdc()
+  {
+    final MemoryIdentityStorage identityStorage = new MemoryIdentityStorage();
+    final MemoryPrivateKeyStorage privateKeyStorage = new MemoryPrivateKeyStorage();
+    final KeyChain keyChain = new KeyChain(new IdentityManager(identityStorage, privateKeyStorage),
+                                           new SelfVerifyPolicyManager(identityStorage));
+
+    // Initialize the storage.
+    Name keyName = new Name("/fake-key/ksk-1426265597681");
+    Name certificateName = new Name("/fake-key/KEY/ksk-1426265597681/ID-CERT/%FD%00%00%01L%14%0D%E8%00");
+
+    try {
+      identityStorage.addKey(keyName, KeyType.RSA,
+                             new Blob(DEFAULT_RSA_PUBLIC_KEY_DER, false));
+      privateKeyStorage.setKeyPairForKeyName(keyName, KeyType.RSA,
+                                             DEFAULT_RSA_PUBLIC_KEY_DER,
+                                             DEFAULT_RSA_PRIVATE_KEY_DER);
+    }
+    catch (net.named_data.jndn.security.SecurityException e) {
+      // shouldn't really happen
+      /// @todo add logging
+    }
+    m_face.setCommandSigningInfo(keyChain, certificateName);
+  }
+
+  public void
+  shutdown()
+  {
+    m_face.shutdown();
+  }
+
+  /**
+   * @brief Adds a nexthop to a FIB entry
+   *
+   * If the FIB entry does not exist, it is inserted automatically
+   */
+  public void
+  fibAddNextHop(Name prefix, int faceId, int cost)
+  {
+  }
+
+  /**
+   * @brief Removes a nexthop from an existing FIB entry
+   *
+   * If the last nexthop record in a FIB entry is removed, the FIB entry is also deleted
+   */
+  public void
+  fibRemoveNextHop(Name prefix, int faceId)
+  {
+
+  }
+
+  /**
+   * @brief Registers name to the given faceId or faceUri
+   */
+  public void
+  ribRegisterPrefix(Name prefix, int faceId, int cost, boolean isChildInherit, boolean isCapture)
+  {
+  }
+
+  /**
+   * @brief Unregisters name from the given faceId/faceUri
+   */
+  public void
+  ribUnregisterPrefix(Name prefix, int faceIdName)
+  {
+
+  }
+
+  /**
+   * @brief Creates new face
+   *
+   * This command allows creation of UDP unicast and TCP faces only
+   */
+  public int
+  faceCreate(String faceUri) throws Exception, FaceUri.Error, FaceUri.CanonizeError
+  {
+    return NFD.createFace(m_face, new FaceUri(faceUri).canonize().toString());
+  }
+
+  /**
+   * @brief Destroys face
+   */
+  public void
+  faceDestroy(int faceId) throws Exception
+  {
+    NFD.destroyFace(m_face, faceId);
+  }
+
+  /**
+   * @brief List all faces
+   */
+  public List<FaceStatus>
+  faceList() throws Exception
+  {
+    return NFD.getFaceList(m_face);
+  }
+
+  /**
+   * @brief Sets the strategy for a namespace
+   */
+  public void
+  strategyChoiceSet(Name namespace, Name strategy)
+  {
+
+  }
+
+  /**
+   * @brief Unset the strategy for a namespace
+   */
+  public void
+  strategyChoiceUnset(Name namespace)
+  {
+
+  }
+
+  /////////////////////////////////////////////////////////////////////////////
+
+  final private Face m_face = new Face();
+
+  // temporary hack
+
+  private static final ByteBuffer DEFAULT_RSA_PUBLIC_KEY_DER = toBuffer(new int[]{
+      0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
+      0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01,
+      0x00, 0xb8, 0x09, 0xa7, 0x59, 0x82, 0x84, 0xec, 0x4f, 0x06, 0xfa, 0x1c, 0xb2, 0xe1, 0x38, 0x93,
+      0x53, 0xbb, 0x7d, 0xd4, 0xac, 0x88, 0x1a, 0xf8, 0x25, 0x11, 0xe4, 0xfa, 0x1d, 0x61, 0x24, 0x5b,
+      0x82, 0xca, 0xcd, 0x72, 0xce, 0xdb, 0x66, 0xb5, 0x8d, 0x54, 0xbd, 0xfb, 0x23, 0xfd, 0xe8, 0x8e,
+      0xaf, 0xa7, 0xb3, 0x79, 0xbe, 0x94, 0xb5, 0xb7, 0xba, 0x17, 0xb6, 0x05, 0xae, 0xce, 0x43, 0xbe,
+      0x3b, 0xce, 0x6e, 0xea, 0x07, 0xdb, 0xbf, 0x0a, 0x7e, 0xeb, 0xbc, 0xc9, 0x7b, 0x62, 0x3c, 0xf5,
+      0xe1, 0xce, 0xe1, 0xd9, 0x8d, 0x9c, 0xfe, 0x1f, 0xc7, 0xf8, 0xfb, 0x59, 0xc0, 0x94, 0x0b, 0x2c,
+      0xd9, 0x7d, 0xbc, 0x96, 0xeb, 0xb8, 0x79, 0x22, 0x8a, 0x2e, 0xa0, 0x12, 0x1d, 0x42, 0x07, 0xb6,
+      0x5d, 0xdb, 0xe1, 0xf6, 0xb1, 0x5d, 0x7b, 0x1f, 0x54, 0x52, 0x1c, 0xa3, 0x11, 0x9b, 0xf9, 0xeb,
+      0xbe, 0xb3, 0x95, 0xca, 0xa5, 0x87, 0x3f, 0x31, 0x18, 0x1a, 0xc9, 0x99, 0x01, 0xec, 0xaa, 0x90,
+      0xfd, 0x8a, 0x36, 0x35, 0x5e, 0x12, 0x81, 0xbe, 0x84, 0x88, 0xa1, 0x0d, 0x19, 0x2a, 0x4a, 0x66,
+      0xc1, 0x59, 0x3c, 0x41, 0x83, 0x3d, 0x3d, 0xb8, 0xd4, 0xab, 0x34, 0x90, 0x06, 0x3e, 0x1a, 0x61,
+      0x74, 0xbe, 0x04, 0xf5, 0x7a, 0x69, 0x1b, 0x9d, 0x56, 0xfc, 0x83, 0xb7, 0x60, 0xc1, 0x5e, 0x9d,
+      0x85, 0x34, 0xfd, 0x02, 0x1a, 0xba, 0x2c, 0x09, 0x72, 0xa7, 0x4a, 0x5e, 0x18, 0xbf, 0xc0, 0x58,
+      0xa7, 0x49, 0x34, 0x46, 0x61, 0x59, 0x0e, 0xe2, 0x6e, 0x9e, 0xd2, 0xdb, 0xfd, 0x72, 0x2f, 0x3c,
+      0x47, 0xcc, 0x5f, 0x99, 0x62, 0xee, 0x0d, 0xf3, 0x1f, 0x30, 0x25, 0x20, 0x92, 0x15, 0x4b, 0x04,
+      0xfe, 0x15, 0x19, 0x1d, 0xdc, 0x7e, 0x5c, 0x10, 0x21, 0x52, 0x21, 0x91, 0x54, 0x60, 0x8b, 0x92,
+      0x41, 0x02, 0x03, 0x01, 0x00, 0x01
+    });
+
+  // Java uses an unencrypted PKCS #8 PrivateKeyInfo, not a PKCS #1 RSAPrivateKey.
+  private static final ByteBuffer DEFAULT_RSA_PRIVATE_KEY_DER = toBuffer(new int[]{
+      0x30, 0x82, 0x04, 0xbf, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
+      0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, 0x04, 0xa9, 0x30, 0x82, 0x04, 0xa5, 0x02, 0x01,
+      0x00, 0x02, 0x82, 0x01, 0x01, 0x00, 0xb8, 0x09, 0xa7, 0x59, 0x82, 0x84, 0xec, 0x4f, 0x06, 0xfa,
+      0x1c, 0xb2, 0xe1, 0x38, 0x93, 0x53, 0xbb, 0x7d, 0xd4, 0xac, 0x88, 0x1a, 0xf8, 0x25, 0x11, 0xe4,
+      0xfa, 0x1d, 0x61, 0x24, 0x5b, 0x82, 0xca, 0xcd, 0x72, 0xce, 0xdb, 0x66, 0xb5, 0x8d, 0x54, 0xbd,
+      0xfb, 0x23, 0xfd, 0xe8, 0x8e, 0xaf, 0xa7, 0xb3, 0x79, 0xbe, 0x94, 0xb5, 0xb7, 0xba, 0x17, 0xb6,
+      0x05, 0xae, 0xce, 0x43, 0xbe, 0x3b, 0xce, 0x6e, 0xea, 0x07, 0xdb, 0xbf, 0x0a, 0x7e, 0xeb, 0xbc,
+      0xc9, 0x7b, 0x62, 0x3c, 0xf5, 0xe1, 0xce, 0xe1, 0xd9, 0x8d, 0x9c, 0xfe, 0x1f, 0xc7, 0xf8, 0xfb,
+      0x59, 0xc0, 0x94, 0x0b, 0x2c, 0xd9, 0x7d, 0xbc, 0x96, 0xeb, 0xb8, 0x79, 0x22, 0x8a, 0x2e, 0xa0,
+      0x12, 0x1d, 0x42, 0x07, 0xb6, 0x5d, 0xdb, 0xe1, 0xf6, 0xb1, 0x5d, 0x7b, 0x1f, 0x54, 0x52, 0x1c,
+      0xa3, 0x11, 0x9b, 0xf9, 0xeb, 0xbe, 0xb3, 0x95, 0xca, 0xa5, 0x87, 0x3f, 0x31, 0x18, 0x1a, 0xc9,
+      0x99, 0x01, 0xec, 0xaa, 0x90, 0xfd, 0x8a, 0x36, 0x35, 0x5e, 0x12, 0x81, 0xbe, 0x84, 0x88, 0xa1,
+      0x0d, 0x19, 0x2a, 0x4a, 0x66, 0xc1, 0x59, 0x3c, 0x41, 0x83, 0x3d, 0x3d, 0xb8, 0xd4, 0xab, 0x34,
+      0x90, 0x06, 0x3e, 0x1a, 0x61, 0x74, 0xbe, 0x04, 0xf5, 0x7a, 0x69, 0x1b, 0x9d, 0x56, 0xfc, 0x83,
+      0xb7, 0x60, 0xc1, 0x5e, 0x9d, 0x85, 0x34, 0xfd, 0x02, 0x1a, 0xba, 0x2c, 0x09, 0x72, 0xa7, 0x4a,
+      0x5e, 0x18, 0xbf, 0xc0, 0x58, 0xa7, 0x49, 0x34, 0x46, 0x61, 0x59, 0x0e, 0xe2, 0x6e, 0x9e, 0xd2,
+      0xdb, 0xfd, 0x72, 0x2f, 0x3c, 0x47, 0xcc, 0x5f, 0x99, 0x62, 0xee, 0x0d, 0xf3, 0x1f, 0x30, 0x25,
+      0x20, 0x92, 0x15, 0x4b, 0x04, 0xfe, 0x15, 0x19, 0x1d, 0xdc, 0x7e, 0x5c, 0x10, 0x21, 0x52, 0x21,
+      0x91, 0x54, 0x60, 0x8b, 0x92, 0x41, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x82, 0x01, 0x01, 0x00,
+      0x8a, 0x05, 0xfb, 0x73, 0x7f, 0x16, 0xaf, 0x9f, 0xa9, 0x4c, 0xe5, 0x3f, 0x26, 0xf8, 0x66, 0x4d,
+      0xd2, 0xfc, 0xd1, 0x06, 0xc0, 0x60, 0xf1, 0x9f, 0xe3, 0xa6, 0xc6, 0x0a, 0x48, 0xb3, 0x9a, 0xca,
+      0x21, 0xcd, 0x29, 0x80, 0x88, 0x3d, 0xa4, 0x85, 0xa5, 0x7b, 0x82, 0x21, 0x81, 0x28, 0xeb, 0xf2,
+      0x43, 0x24, 0xb0, 0x76, 0xc5, 0x52, 0xef, 0xc2, 0xea, 0x4b, 0x82, 0x41, 0x92, 0xc2, 0x6d, 0xa6,
+      0xae, 0xf0, 0xb2, 0x26, 0x48, 0xa1, 0x23, 0x7f, 0x02, 0xcf, 0xa8, 0x90, 0x17, 0xa2, 0x3e, 0x8a,
+      0x26, 0xbd, 0x6d, 0x8a, 0xee, 0xa6, 0x0c, 0x31, 0xce, 0xc2, 0xbb, 0x92, 0x59, 0xb5, 0x73, 0xe2,
+      0x7d, 0x91, 0x75, 0xe2, 0xbd, 0x8c, 0x63, 0xe2, 0x1c, 0x8b, 0xc2, 0x6a, 0x1c, 0xfe, 0x69, 0xc0,
+      0x44, 0xcb, 0x58, 0x57, 0xb7, 0x13, 0x42, 0xf0, 0xdb, 0x50, 0x4c, 0xe0, 0x45, 0x09, 0x8f, 0xca,
+      0x45, 0x8a, 0x06, 0xfe, 0x98, 0xd1, 0x22, 0xf5, 0x5a, 0x9a, 0xdf, 0x89, 0x17, 0xca, 0x20, 0xcc,
+      0x12, 0xa9, 0x09, 0x3d, 0xd5, 0xf7, 0xe3, 0xeb, 0x08, 0x4a, 0xc4, 0x12, 0xc0, 0xb9, 0x47, 0x6c,
+      0x79, 0x50, 0x66, 0xa3, 0xf8, 0xaf, 0x2c, 0xfa, 0xb4, 0x6b, 0xec, 0x03, 0xad, 0xcb, 0xda, 0x24,
+      0x0c, 0x52, 0x07, 0x87, 0x88, 0xc0, 0x21, 0xf3, 0x02, 0xe8, 0x24, 0x44, 0x0f, 0xcd, 0xa0, 0xad,
+      0x2f, 0x1b, 0x79, 0xab, 0x6b, 0x49, 0x4a, 0xe6, 0x3b, 0xd0, 0xad, 0xc3, 0x48, 0xb9, 0xf7, 0xf1,
+      0x34, 0x09, 0xeb, 0x7a, 0xc0, 0xd5, 0x0d, 0x39, 0xd8, 0x45, 0xce, 0x36, 0x7a, 0xd8, 0xde, 0x3c,
+      0xb0, 0x21, 0x96, 0x97, 0x8a, 0xff, 0x8b, 0x23, 0x60, 0x4f, 0xf0, 0x3d, 0xd7, 0x8f, 0xf3, 0x2c,
+      0xcb, 0x1d, 0x48, 0x3f, 0x86, 0xc4, 0xa9, 0x00, 0xf2, 0x23, 0x2d, 0x72, 0x4d, 0x66, 0xa5, 0x01,
+      0x02, 0x81, 0x81, 0x00, 0xdc, 0x4f, 0x99, 0x44, 0x0d, 0x7f, 0x59, 0x46, 0x1e, 0x8f, 0xe7, 0x2d,
+      0x8d, 0xdd, 0x54, 0xc0, 0xf7, 0xfa, 0x46, 0x0d, 0x9d, 0x35, 0x03, 0xf1, 0x7c, 0x12, 0xf3, 0x5a,
+      0x9d, 0x83, 0xcf, 0xdd, 0x37, 0x21, 0x7c, 0xb7, 0xee, 0xc3, 0x39, 0xd2, 0x75, 0x8f, 0xb2, 0x2d,
+      0x6f, 0xec, 0xc6, 0x03, 0x55, 0xd7, 0x00, 0x67, 0xd3, 0x9b, 0xa2, 0x68, 0x50, 0x6f, 0x9e, 0x28,
+      0xa4, 0x76, 0x39, 0x2b, 0xb2, 0x65, 0xcc, 0x72, 0x82, 0x93, 0xa0, 0xcf, 0x10, 0x05, 0x6a, 0x75,
+      0xca, 0x85, 0x35, 0x99, 0xb0, 0xa6, 0xc6, 0xef, 0x4c, 0x4d, 0x99, 0x7d, 0x2c, 0x38, 0x01, 0x21,
+      0xb5, 0x31, 0xac, 0x80, 0x54, 0xc4, 0x18, 0x4b, 0xfd, 0xef, 0xb3, 0x30, 0x22, 0x51, 0x5a, 0xea,
+      0x7d, 0x9b, 0xb2, 0x9d, 0xcb, 0xba, 0x3f, 0xc0, 0x1a, 0x6b, 0xcd, 0xb0, 0xe6, 0x2f, 0x04, 0x33,
+      0xd7, 0x3a, 0x49, 0x71, 0x02, 0x81, 0x81, 0x00, 0xd5, 0xd9, 0xc9, 0x70, 0x1a, 0x13, 0xb3, 0x39,
+      0x24, 0x02, 0xee, 0xb0, 0xbb, 0x84, 0x17, 0x12, 0xc6, 0xbd, 0x65, 0x73, 0xe9, 0x34, 0x5d, 0x43,
+      0xff, 0xdc, 0xf8, 0x55, 0xaf, 0x2a, 0xb9, 0xe1, 0xfa, 0x71, 0x65, 0x4e, 0x50, 0x0f, 0xa4, 0x3b,
+      0xe5, 0x68, 0xf2, 0x49, 0x71, 0xaf, 0x15, 0x88, 0xd7, 0xaf, 0xc4, 0x9d, 0x94, 0x84, 0x6b, 0x5b,
+      0x10, 0xd5, 0xc0, 0xaa, 0x0c, 0x13, 0x62, 0x99, 0xc0, 0x8b, 0xfc, 0x90, 0x0f, 0x87, 0x40, 0x4d,
+      0x58, 0x88, 0xbd, 0xe2, 0xba, 0x3e, 0x7e, 0x2d, 0xd7, 0x69, 0xa9, 0x3c, 0x09, 0x64, 0x31, 0xb6,
+      0xcc, 0x4d, 0x1f, 0x23, 0xb6, 0x9e, 0x65, 0xd6, 0x81, 0xdc, 0x85, 0xcc, 0x1e, 0xf1, 0x0b, 0x84,
+      0x38, 0xab, 0x93, 0x5f, 0x9f, 0x92, 0x4e, 0x93, 0x46, 0x95, 0x6b, 0x3e, 0xb6, 0xc3, 0x1b, 0xd7,
+      0x69, 0xa1, 0x0a, 0x97, 0x37, 0x78, 0xed, 0xd1, 0x02, 0x81, 0x80, 0x33, 0x18, 0xc3, 0x13, 0x65,
+      0x8e, 0x03, 0xc6, 0x9f, 0x90, 0x00, 0xae, 0x30, 0x19, 0x05, 0x6f, 0x3c, 0x14, 0x6f, 0xea, 0xf8,
+      0x6b, 0x33, 0x5e, 0xee, 0xc7, 0xf6, 0x69, 0x2d, 0xdf, 0x44, 0x76, 0xaa, 0x32, 0xba, 0x1a, 0x6e,
+      0xe6, 0x18, 0xa3, 0x17, 0x61, 0x1c, 0x92, 0x2d, 0x43, 0x5d, 0x29, 0xa8, 0xdf, 0x14, 0xd8, 0xff,
+      0xdb, 0x38, 0xef, 0xb8, 0xb8, 0x2a, 0x96, 0x82, 0x8e, 0x68, 0xf4, 0x19, 0x8c, 0x42, 0xbe, 0xcc,
+      0x4a, 0x31, 0x21, 0xd5, 0x35, 0x6c, 0x5b, 0xa5, 0x7c, 0xff, 0xd1, 0x85, 0x87, 0x28, 0xdc, 0x97,
+      0x75, 0xe8, 0x03, 0x80, 0x1d, 0xfd, 0x25, 0x34, 0x41, 0x31, 0x21, 0x12, 0x87, 0xe8, 0x9a, 0xb7,
+      0x6a, 0xc0, 0xc4, 0x89, 0x31, 0x15, 0x45, 0x0d, 0x9c, 0xee, 0xf0, 0x6a, 0x2f, 0xe8, 0x59, 0x45,
+      0xc7, 0x7b, 0x0d, 0x6c, 0x55, 0xbb, 0x43, 0xca, 0xc7, 0x5a, 0x01, 0x02, 0x81, 0x81, 0x00, 0xab,
+      0xf4, 0xd5, 0xcf, 0x78, 0x88, 0x82, 0xc2, 0xdd, 0xbc, 0x25, 0xe6, 0xa2, 0xc1, 0xd2, 0x33, 0xdc,
+      0xef, 0x0a, 0x97, 0x2b, 0xdc, 0x59, 0x6a, 0x86, 0x61, 0x4e, 0xa6, 0xc7, 0x95, 0x99, 0xa6, 0xa6,
+      0x55, 0x6c, 0x5a, 0x8e, 0x72, 0x25, 0x63, 0xac, 0x52, 0xb9, 0x10, 0x69, 0x83, 0x99, 0xd3, 0x51,
+      0x6c, 0x1a, 0xb3, 0x83, 0x6a, 0xff, 0x50, 0x58, 0xb7, 0x28, 0x97, 0x13, 0xe2, 0xba, 0x94, 0x5b,
+      0x89, 0xb4, 0xea, 0xba, 0x31, 0xcd, 0x78, 0xe4, 0x4a, 0x00, 0x36, 0x42, 0x00, 0x62, 0x41, 0xc6,
+      0x47, 0x46, 0x37, 0xea, 0x6d, 0x50, 0xb4, 0x66, 0x8f, 0x55, 0x0c, 0xc8, 0x99, 0x91, 0xd5, 0xec,
+      0xd2, 0x40, 0x1c, 0x24, 0x7d, 0x3a, 0xff, 0x74, 0xfa, 0x32, 0x24, 0xe0, 0x11, 0x2b, 0x71, 0xad,
+      0x7e, 0x14, 0xa0, 0x77, 0x21, 0x68, 0x4f, 0xcc, 0xb6, 0x1b, 0xe8, 0x00, 0x49, 0x13, 0x21, 0x02,
+      0x81, 0x81, 0x00, 0xb6, 0x18, 0x73, 0x59, 0x2c, 0x4f, 0x92, 0xac, 0xa2, 0x2e, 0x5f, 0xb6, 0xbe,
+      0x78, 0x5d, 0x47, 0x71, 0x04, 0x92, 0xf0, 0xd7, 0xe8, 0xc5, 0x7a, 0x84, 0x6b, 0xb8, 0xb4, 0x30,
+      0x1f, 0xd8, 0x0d, 0x58, 0xd0, 0x64, 0x80, 0xa7, 0x21, 0x1a, 0x48, 0x00, 0x37, 0xd6, 0x19, 0x71,
+      0xbb, 0x91, 0x20, 0x9d, 0xe2, 0xc3, 0xec, 0xdb, 0x36, 0x1c, 0xca, 0x48, 0x7d, 0x03, 0x32, 0x74,
+      0x1e, 0x65, 0x73, 0x02, 0x90, 0x73, 0xd8, 0x3f, 0xb5, 0x52, 0x35, 0x79, 0x1c, 0xee, 0x93, 0xa3,
+      0x32, 0x8b, 0xed, 0x89, 0x98, 0xf1, 0x0c, 0xd8, 0x12, 0xf2, 0x89, 0x7f, 0x32, 0x23, 0xec, 0x67,
+      0x66, 0x52, 0x83, 0x89, 0x99, 0x5e, 0x42, 0x2b, 0x42, 0x4b, 0x84, 0x50, 0x1b, 0x3e, 0x47, 0x6d,
+      0x74, 0xfb, 0xd1, 0xa6, 0x10, 0x20, 0x6c, 0x6e, 0xbe, 0x44, 0x3f, 0xb9, 0xfe, 0xbc, 0x8d, 0xda,
+      0xcb, 0xea, 0x8f
+    });
+
+  private static ByteBuffer
+  toBuffer(int[] array)
+  {
+    ByteBuffer result = ByteBuffer.allocate(array.length);
+    for (int i = 0; i < array.length; ++i)
+      result.put((byte) (array[i] & 0xff));
+
+    result.flip();
+    return result;
+  }
+}
diff --git a/app/src/main/java/net/named_data/nfd/utils/NfdcAsyncTask.java b/app/src/main/java/net/named_data/nfd/utils/NfdcAsyncTask.java
new file mode 100644
index 0000000..cbf1406
--- /dev/null
+++ b/app/src/main/java/net/named_data/nfd/utils/NfdcAsyncTask.java
@@ -0,0 +1,82 @@
+/* -*- Mode:jde; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2015 Regents of the University of California
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon) Android.
+ * See AUTHORS.md for complete list of NFD Android authors and contributors.
+ *
+ * NFD Android is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD Android is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD Android, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package net.named_data.nfd.utils;
+
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.os.AsyncTask;
+import android.widget.Toast;
+
+
+public class NfdcAsyncTask extends AsyncTask<Void, Void, String> {
+
+  public NfdcAsyncTask(Context context, Task task)
+  {
+    m_context = context;
+    m_progressBar = new ProgressDialog(m_context);
+    m_task = task;
+  }
+
+  public interface Task {
+    public String
+    runTask() throws Exception;
+  }
+
+  @Override
+  protected String
+  doInBackground(Void... params)
+  {
+    try {
+      return m_task.runTask();
+    }
+    catch (Exception e) {
+      return "Error communicating with NFD (" + e.getMessage() + ")";
+    }
+  }
+
+  @Override
+  protected void
+  onPostExecute(String result)
+  {
+    m_progressBar.dismiss();
+    if (result != null)
+      Toast.makeText(m_context.getApplicationContext(), result, Toast.LENGTH_LONG).show();
+  }
+
+  @Override
+  protected void
+  onPreExecute()
+  {
+    m_progressBar.setMessage("Communicating with NFD...");
+    m_progressBar.show();
+  }
+
+  @Override
+  protected void
+  onProgressUpdate(Void... values)
+  {
+  }
+
+  /////////////////////////////////////////////////////////////////////////////
+
+  private Context m_context = null;
+  private ProgressDialog m_progressBar = null;
+  private Task m_task = null;
+}
diff --git a/app/src/main/res/layout/create_face.xml b/app/src/main/res/layout/create_face.xml
new file mode 100644
index 0000000..6588dcc
--- /dev/null
+++ b/app/src/main/res/layout/create_face.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="wrap_content">
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        style="@style/dialog_margin"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:text="Enter FaceUri for the remote NDN daemon"
+        android:layout_gravity="center_horizontal"/>
+
+    <EditText
+        android:id="@+id/faceUri"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        style="@style/dialog_margin"
+        android:hint="Face URI"
+        android:inputType="text"
+        android:focusable="true"
+        android:focusableInTouchMode="true"
+        android:selectAllOnFocus="true">
+        <requestFocus />
+     </EditText>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/face_list_item.xml b/app/src/main/res/layout/face_list_item.xml
new file mode 100644
index 0000000..2660a58
--- /dev/null
+++ b/app/src/main/res/layout/face_list_item.xml
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                 android:layout_width="match_parent"
+                 android:layout_height="wrap_content"
+                 android:minHeight="?android:attr/listPreferredItemHeight">
+
+    <LinearLayout
+        android:orientation="horizontal"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentTop="true"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentStart="true"
+        android:id="@+id/firstLine">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:textAppearance="@android:style/TextAppearance.DeviceDefault.SearchResult.Subtitle"
+            android:text="LocalUri"
+            android:id="@+id/localUri"
+            android:layout_alignParentTop="true"
+            android:layout_alignParentRight="true"
+            android:layout_alignParentEnd="true"
+            android:layout_margin="5dp"
+            android:layout_weight="1"
+            android:singleLine="true"/>
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:textAppearance="@android:style/TextAppearance.DeviceDefault.SearchResult.Subtitle"
+            android:text="RemoteUri"
+            android:id="@+id/remoteUri"
+            android:layout_alignParentTop="true"
+            android:layout_alignParentLeft="true"
+            android:layout_alignParentStart="true"
+            android:layout_margin="5dp"
+            android:layout_weight="1"
+            android:singleLine="true"/>
+    </LinearLayout>
+
+    <LinearLayout
+        android:orientation="horizontal"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentTop="false"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentStart="true"
+        android:layout_alignParentEnd="false"
+        android:layout_below="@+id/firstLine"
+        android:id="@+id/secondLine"
+        android:layout_margin="5dp">
+
+        <LinearLayout
+            android:orientation="horizontal"
+            android:layout_width="0dp"
+            android:layout_weight="0.9"
+            android:layout_height="wrap_content"
+            android:layout_below="@+id/linearLayout"
+            android:id="@+id/idBlock">
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:textAppearance="?android:attr/textAppearanceSmall"
+                android:text="ActualId"
+                android:id="@+id/faceId"
+                android:singleLine="true"/>
+
+        </LinearLayout>
+
+        <LinearLayout
+            android:orientation="horizontal"
+            android:layout_width="0dp"
+            android:layout_weight="1.5"
+            android:layout_height="wrap_content"
+            android:id="@+id/scopeBlock">
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:textAppearance="?android:attr/textAppearanceSmall"
+                android:text="Scope"
+                android:id="@+id/scope"
+                android:singleLine="true"
+                android:layout_marginLeft="5dp"
+                android:layout_marginRight="5dp"/>
+
+        </LinearLayout>
+
+        <LinearLayout
+            android:orientation="horizontal"
+            android:layout_width="0dp"
+            android:layout_weight="1.2"
+            android:layout_height="wrap_content"
+            android:id="@+id/persistencyBlock">
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:textAppearance="?android:attr/textAppearanceSmall"
+                android:text="Type"
+                android:id="@+id/persistency"
+                android:singleLine="true"
+                android:layout_marginLeft="5dp"
+                android:layout_marginRight="5dp"/>
+
+        </LinearLayout>
+
+        <LinearLayout
+            android:orientation="horizontal"
+            android:layout_width="0dp"
+            android:layout_weight="1.6"
+            android:layout_height="wrap_content"
+            android:id="@+id/expiresBlock">
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:textAppearance="?android:attr/textAppearanceSmall"
+                android:text="Expires"
+                android:id="@+id/expires"
+                android:singleLine="true"
+                android:visibility="visible"/>
+
+        </LinearLayout>
+    </LinearLayout>
+
+
+</RelativeLayout>
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 766ab99..9484591 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -5,4 +5,11 @@
         <!-- Customize your theme here. -->
     </style>
 
+    <style name="dialog_margin">
+        <item name="android:layout_marginTop">16dp</item>
+        <item name="android:layout_marginLeft">4dp</item>
+        <item name="android:layout_marginRight">4dp</item>
+        <item name="android:layout_marginBottom">4dp</item>
+    </style>
+
 </resources>
diff --git a/app/src/main/res/xml/pref_face.xml b/app/src/main/res/xml/pref_face.xml
new file mode 100644
index 0000000..b05ce89
--- /dev/null
+++ b/app/src/main/res/xml/pref_face.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+  <PreferenceCategory
+      android:key="faces"
+      android:title="Faces">
+
+    <Preference android:title="Create face" android:key="create_face" />
+
+    <PreferenceScreen android:title="List faces" android:key="list">
+        <intent android:action="android.intent.action.VIEW"
+                android:targetPackage="net.named_data.nfd"
+                android:targetClass="net.named_data.nfd.FaceListActivity" />
+    </PreferenceScreen>
+
+  </PreferenceCategory>
+</PreferenceScreen>